Diagnosing subnet overlap in a cluster
Раздел «For cluster administrators»: быстрый переход по подразделам
На этой странице
When creating a cluster (client or management) in the Shturval platform, the following subnets are allocated by default:
- pod subnet: 172.16.0.0/16;
- service subnet: 10.96.0.0/12.
For more information about cluster subnets, see Subnet allocation.
When configuring a cluster with custom subnets (not the defaults), check IP address ranges for overlap (for example, using an online calculator). A cluster with overlapping subnets in its configuration will not deploy successfully.
You can detect subnet overlap after cluster initialization by the following signs:
- Cluster nodes do not receive PodCIDR;
Example check command
kubectl get nodes -o custom-columns=NAME:.metadata.name,PODCIDR:.spec.podCIDR
PodCIDR will be empty in the output.
- cilium-agent logs show a PodCIDR IP address error, so it does not initialize;
Example check command
kubectl -n kube-system logs ds/cilium --all-pods --all-containers | grep -i cidr
# Example log output with a PodCIDR error
level=warning msg="Waiting for k8s node information" error="required IPv4 PodCIDR not available"
- kube-controller-manager cannot allocate a subnet, and the logs contain no subnet conflict errors.
Example check command
kubectl -n kube-system logs -l component=kube-controller-manager --all-pods --all-containers | grep -i cidr
The output will be empty.
If you detect overlapping IP address ranges in pod or service subnets in an initialized cluster, recreate the cluster with a correct subnet configuration.
Example configuration with overlapping subnets
podSubnet: 100.0.0.0/18 # 100.0.0.0 — 100.0.63.255
serviceSubnet: 100.0.64.0/16 # 100.0.0.0 — 100.0.255.255
Examples of correct subnet configuration
# Example 1
podSubnet: 100.0.0.0/18 # 100.0.0.0 — 100.0.63.255
serviceSubnet: 100.0.64.0/18 # 100.0.64.0 — 100.0.127.255
# Example 2
podSubnet: 100.0.0.0/16 # 100.0.0.0 — 100.0.255.255
serviceSubnet: 100.1.0.0/16 # 100.1.0.0 — 100.1.255.255
# Example 3
podSubnet: 10.244.0.0/16 # 10.244.0.0 — 10.244.255.255
serviceSubnet: 10.96.0.0/16 # 10.96.0.0 — 10.96.255.255
Example command to get subnet configuration
kubectl get cm -n kube-system kubeadm-config -o yaml | grep -i subnet