Skip to content

Pod network CIDR alignment

Pod network CIDR alignment is a configuration requirement in Kubernetes clusters where the Classless Inter-Domain Routing (CIDR) block specified during the control plane initialization must match the network configuration of the deployed Container Network Interface (CNI) plugin.^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md]

Configuration Process

When initializing the Kubernetes Control Plane using kubeadm, the --pod-network-cidr flag is used to define the IP address range for Pod IPs^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md]. This value must be identical to the network setting defined within the CNI plugin's configuration file^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md].

Flannel Example

In the specific case of the Flannel network plugin, this requires modifying the kube-flannel.yml file^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md]. The default Network configuration in the manifest (10.244.0.0/16) must be changed to align with the CIDR passed to kubeadm init (for example, 192.168.0.0/16)^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md].

If these values are not aligned, the cluster nodes may fail to transition to the Ready status, as the kubelet cannot correctly allocate Pod IP addresses.^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md]

Sources

  • 400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md