#!/bin/bash set -eu export KUBECONFIG=/root/.kube/config pkill -f 'docker pull ghcr.io/flannel-io/flannel' || true kubectl delete ds -n kube-flannel kube-flannel-ds --ignore-not-found mkdir -p /etc/cni/net.d cat > /etc/cni/net.d/10-bridge.conflist << 'EOF' { "cniVersion": "1.0.0", "name": "k8s-pod-network", "plugins": [ { "type": "bridge", "bridge": "cni0", "isGateway": true, "ipMasq": true, "promiscMode": true, "ipam": { "type": "host-local", "ranges": [[{"subnet": "10.244.0.0/24"}]], "routes": [{"dst": "0.0.0.0/0"}] } }, { "type": "portmap", "capabilities": {"portMappings": true} } ] } EOF systemctl restart kubelet ok=0 for i in $(seq 1 36); do ready=$(kubectl get node prod102 -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' || true) echo "ready=$ready" if [ "$ready" = "True" ]; then ok=1 break fi sleep 5 done kubectl get nodes -o wide kubectl get pods -A -o wide if [ "$ok" != "1" ]; then echo NODE_STILL_NOT_READY exit 1 fi echo CONTROL_PLANE_OK