A Flannel Pod may enter
CrashLoopBackOff with pod cidr not assigned when its node has no Pod CIDR assigned. This guide focuses on a kubeadm cluster using Flannel's Kubernetes subnet manager.Inspect the symptoms
bash_snippet
Bash · 4 lines|
| kubectl get nodes -o wide |
| kubectl get pods -A |
| kubectl logs -n kube-system <flannel-pod> --previous |
| kubectl get node <node-name> -o jsonpath='{.spec.podCIDR}' |
A successful
kubeadm join alone does not guarantee that the network plugin is ready.Check CIDR allocation
Inspect the controller-manager configuration and logs. In a kubeadm setup, the static Pod manifest is commonly
/etc/kubernetes/manifests/kube-controller-manager.yaml. Verify that node CIDR allocation is enabled and that --cluster-cidr matches the cluster's intended Pod network. Check that the Flannel network configuration matches the same network and does not overlap node or Service networks.For a new kubeadm cluster,
--pod-network-cidr at initialization configures the intended Pod network. Existing cluster network changes are more complex: plan them for the installed Kubernetes and Flannel versions rather than rerunning initialization on an active cluster.Resolve and verify
Correct the underlying configuration using your cluster's supported management procedure. Then confirm each node receives a unique, non-overlapping Pod CIDR and that Flannel Pods become ready.
The original workaround manually patched a node's
spec.podCIDR. Avoid doing this casually: allocations must be consistent with the controller and all other nodes, and existing Pod networking can be disrupted. Investigate the allocator first and plan any manual recovery with a current backup.✦ 卷终 · 柯航存卷 ✦