Diagnostics of intersection of subnets in a cluster
In the Shturval platform, when you create a cluster (client or management), the following subnets are assigned by default:
- pod subnet: 172.16.0.0/16;
- service subnet: 10.96.0.0/12.
For more information about cluster subnets, see Cluster networks.
When configuring a cluster with your subnets (not default), check the IP address ranges for intersection (for example, using an online calculator). A cluster with a configuration that has overlapping subnets will not deploy successfully.
Signs of errors
Cluster nodes do not receive PodCIDR
Example check command:
kubectl get nodes -o custom-columns=NAME:.metadata.name,PODCIDR:.spec.podCIDR
PodCIDR will be blank in the response.
PodCIDR IP address error
There is an error in the PodCIDR IP address in the cilium-agent logs, which is why it is not initialized;
Example check command:
kubectl -n kube-system logs ds/cilium --all-pods --all-containers | grep -i cidr
# Example of log output with PodCIDR error
level=warning msg="Waiting for k8s node information" error="required IPv4 PodCIDR not available"
Kube-controller-manager cannot allocate a subnet
Kube-controller-manager cannot allocate a subnet, and there are no errors in the logs about a subnet conflict.
Example check command:
kubectl -n kube-system get po -l component=kube-controller-manager -o yaml | grep -E "(cluster-cidr|service-cluster-ip-range)"
The answer will be blank.
If you detect an intersection of IP address ranges in the subnets of pods or services in an initialized cluster, re-create the cluster with the correct subnet configuration.
Configuration examples
Example of a configuration with intersecting 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
An example of a command to get the subnet configuration:
kubectl get cm -n kube-system kubeadm-config -o yaml | grep -i subnet