CNI
CNI (Container Network Interface) is the standard that lets Kubernetes delegate pod networking to plugins such as Calico, Cilium, and Flannel. Without a working CNI plugin, nodes stay NotReady and pods cannot get IP addresses or talk to each other.
What CNI does
Kubernetes defines the networking rules (every pod gets its own IP and can reach every other pod) but ships no implementation. When the kubelet creates a pod sandbox, it calls the CNI plugin binary, which allocates an IP, creates a virtual ethernet (veth) pair connecting the pod to the node, and sets up routing.
Choosing a plugin
| Plugin | Strength |
|---|---|
| Calico | Network policy, BGP routing |
| Cilium | eBPF dataplane, deep observability, optional kube-proxy replacement |
| Flannel | Simple overlay, no network policy support |
Network policies are only enforced if the CNI supports them. On a CNI without support, NetworkPolicy objects are accepted but ignored.
Inspecting CNI on a node
ls /etc/cni/net.d/ # CNI configuration filesls /opt/cni/bin/ # plugin binarieskubectl get nodes -o jsonpath='{.items[*].spec.podCIDR}'Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Nodes NotReady, pods ContainerCreating | No CNI installed or config missing | Install a CNI, check /etc/cni/net.d |
| Sandbox creation fails | CNI binary missing | Check /opt/cni/bin |
| Cross-node pod traffic fails | Routing or overlay broken | Check CNI agent pods in kube-system |
RememberA fresh kubeadm cluster has no CNI. The control plane runs, but application pods will not start until you install one.
Common MistakeSwapping CNIs on a live cluster. Existing pod networking breaks. Plan migrations carefully, ideally with a rebuilt or drained node pool.
SecurityWithout a policy-capable CNI and default-deny policies, any pod can reach any other pod in the cluster.
Frequently Asked Questions
Why does Kubernetes not include built-in networking?
Needs vary widely: simple flat networking, policy enforcement, datacenter BGP integration, eBPF performance. A pluggable interface lets each environment choose the implementation that fits.
What does a missing CNI look like?
Nodes show NotReady with a network plugin not ready message, and pods hang in ContainerCreating or Pending. kubectl describe node and describe pod show the error.
Does the CNI replace kube-proxy?
Not by default, but eBPF-based CNIs such as Cilium can replace kube-proxy entirely. Enable that mode before removing the kube-proxy DaemonSet.