k8s/10-init-k8s.yaml
2024-02-18 01:56:19 +01:00

32 lines
1.3 KiB
YAML

---
- name: Init
become: true
hosts: all
environment:
KUBECONFIG: /etc/kubernetes/admin.conf
tasks:
- name: Init k8s
shell: kubeadm init --pod-network-cidr=10.244.0.0/16 --control-plane-endpoint="{{ endpoint }}"
- name: Remove master node taint
shell: kubectl taint node --all node-role.kubernetes.io/control-plane:NoSchedule-
- name: Apply flannel
shell: kubectl apply -f "https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml"
- name: Apply metallb
shell: kubectl apply -f "https://raw.githubusercontent.com/metallb/metallb/v{{ mettallb_version }}/config/manifests/metallb-native.yaml"
- name: Apply nginx ingress
shell: kubectl apply -f "https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v{{ nginx_version }}/deploy/static/provider/baremetal/deploy.yaml"
- name: Apply cert-manager
shell: kubectl apply -f "https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml"
- name: Apply kubegres
shell: kubectl apply -f "https://raw.githubusercontent.com/reactive-tech/kubegres/v{{ kubegres_version }}/kubegres.yaml"
- name: Apply manifests
shell: |
kubectl apply -f - <<EOF
{{ lookup('template', '{{ item }}') }}
EOF
with_fileglob: 'manifests/*.yaml'
- name: Reboot
reboot: