Files
IaC/ansible/k8s_post_install.yml

50 lines
1.4 KiB
YAML

---
- name: CNI Fix
hosts: k8s_nodes
become: true
tasks:
- name: Create CNI symlink
shell: |
mkdir -p /usr/lib/cni
ln -sf /opt/cni/bin/cilium-cni /usr/lib/cni/cilium-cni
changed_when: true
- name: Restart Kubelet
shell: systemctl restart kubelet
- name: Cluster Resources
hosts: masters_group
become: false
tasks:
- name: Install Storage
shell: kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
- name: Install MetalLB
shell: kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.8/config/manifests/metallb-native.yaml
- name: Wait for MetalLB
shell: kubectl wait --namespace metallb-system --for=condition=ready pod -l app=metallb,component=controller --timeout=120s
ignore_errors: true
- name: Fix Webhook
shell: kubectl delete validatingwebhookconfiguration metallb-webhook-configuration
ignore_errors: true
- name: Config IP Pool
shell: |
cat <<EOF | kubectl apply -f -
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: main-pool
namespace: metallb-system
spec:
addresses:
- 10.33.33.210-10.33.33.250
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: l2-adv
namespace: metallb-system
EOF