Pods not coming in ready state due to IP allocation issues using whereabouts
book
Article ID: 378288
calendar_today
Updated On:
Products
VMware Telco Cloud Automation
Issue/Introduction
Looking at the pod events we can see the following:
Warning FailedCreatePodSandBox 3m29s (x8866 over 3h58m) kubelet (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "################": plugin type="multus-cni-network" failed (add): [NameSpace/PodName/ethName]: error adding container to network "ethName": error at storage engine: Could not allocate IP in range: ip: 192.168.1.10/ - 192.168.1.15 / range: net.IPNet{IP:net.IP{0x#,0x#,0x#,0x#}, Mask:net.IPMask{0x#,0x#,0x#,0x#}
The error is talking about IP allocation issue which points to IP exhaustion in whereabouts.
Environment
2.x
Resolution
In order to fix this issue we need to manually clear up IP allocations in whereabouts by following these steps:
Identify the other pods of the same statefulset/deployments by running
kubectl get pod -n namespace | grep -i podname
Make a note of the pods that are part of the same statefulset/deployments
Run the command to identify all the pods in the same statefulset/deployments
Under each item in the array list take a look at the lines Name which is the ip address and podref which is the name of the pod and make a note of these. Note: For statefulset pod the name of podref will be the same as the one that is having an issue. For pods in a deployment it is possible that the name belongs to a pod that no longer exists.
Run the command and identify the ippool that the pod is using by matching the ip range from the error message that we got from the describe command on the pod "Could not allocate IP in range: ip: 192.168.1.10/ - 192.168.1.15"
kubectl get ippools.whereabouts.cni.cncf.io -n whereabouts
Run the command to confirm if you see the name of the pods from the statefulset/deployment under allocation and podref
kubectl get ippools.whereabouts.cni.cncf.io -n whereabouts 192.168.1.1-24 -o yaml
Take a backup of this above yaml file
kubectl get ippools.whereabouts.cni.cncf.io -n whereabouts 192.168.1.1-24 -o yaml > ippool.yaml
Delete the ip of the pod that is having issues for statefulset or delete the pod that no longer exists for deployment pod which was obtained in step 4 by running