#!/bin/bash set -eu export KUBECONFIG=/root/.kube/config f=/usr/cluster/k8s/kube-flannel.yml rm -f "$f" ok=0 for u in \ https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml \ https://cdn.jsdelivr.net/gh/flannel-io/flannel@v0.27.4/Documentation/kube-flannel.yml \ https://gitclone.com/github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml do echo "TRY $u" if curl --http1.1 -fL --retry 2 --connect-timeout 20 -o "$f" "$u"; then ok=1 break fi done test "$ok" = 1 wc -c "$f" python3 - << 'PY' from pathlib import Path p = Path("/usr/cluster/k8s/kube-flannel.yml") text = p.read_text(encoding="utf-8") needle = '"Network": "10.244.0.0/16"' if "EnableNFTables" not in text and needle in text: text = text.replace(needle, needle + ',\n "EnableNFTables": false', 1) p.write_text(text, encoding="utf-8") print("network", "10.244.0.0/16" in text) PY kubectl apply -f "$f" kubectl taint nodes prod102 node-role.kubernetes.io/control-plane:NoSchedule- || true kubectl wait --for=condition=Ready node/prod102 --timeout=240s kubectl get nodes -o wide kubectl get pods -A -o wide echo CONTROL_PLANE_OK