k8s-cni-failed

Kubernetes CNI 网络插件失败的定位

现象

Pod 一直 ContainerCreating,Events 显示 failed to set up sandbox、network plugin is not ready、failed to allocate IP。节点上的 Pod 网络不通。

快速定位

kubectl describe pod <pod> -n <ns>
kubectl get pods -n kube-system -o wide
kubectl logs -n kube-system <cni-pod> --tail=100

节点:

journalctl -u kubelet --since '30 min ago' | grep -i -E 'cni|sandbox|network'
ls /etc/cni/net.d/
crictl pods
ip -br addr

常见根因

  1. CNI DaemonSet Pod 未运行或崩溃。
  2. /etc/cni/net.d/ 配置缺失/损坏。
  3. IP 池耗尽或子网配置错误。
  4. 内核模块/路由/iptables 规则异常。
  5. NetworkPolicy 或 MTU 配置错误。
  6. 节点网络插件与 Kubernetes 版本不兼容。

修复

相关命令