Skip to main content

Cluster Troubleshooting

[Solved] ClusterInformation: connection is unauthorized: Unauthorized – Failed to create pod sandbox: rpc error

When there is a Failed to create pod sandbox error, your pod goes in to ContainerCreating status.

If you describe the pod, you may see that following errors in the Events.

Warning  FailedCreatePodSandBox  2s    kubelet            
Failed to create pod sandbox: rpc error: code = Unknown desc = 
failed to create pod network sandbox k8s_nginx-deployment-994675664-l6hcs_default_bd2c659d-b71f-42ec-a2cd-339e394fae21_0(84b2f34a1304d602341cc88185aae09bfec25e384077d7a72f7d049792b24f5f): 
error adding pod default_nginx-deployment-994675664-l6hcs to CNI network
"k8s-pod-network": plugin type="calico" failed (add): error getting
ClusterInformation: connection is unauthorized: Unauthorized

rpc error: code = Unknown desc = failed to create pod network sandbox k8s_nginx-deployment-56fcf95486-75mdh_default_3b02c59d-61fb-4ba8-b441-b09d8e6a8383_0(1de290e28f3dde70ef8f907cd2fde0de5c80fedd543c7f0e05f3f0808fc115ad): error adding pod default_nginx-deployment-56fcf95486-75mdh to CNI network "k8s-pod-network": plugin type="calico" failed (add): error getting ClusterInformation: connection is unauthorized: Unauthorized

This error primarily occurs due to resource constraint for calico pods.

Calico uses a component called Felix, which runs on each node and is responsible for managing the network policies and routing for that node.

If there are not enough CPU and memory resources available on a node, Felix may not be able to function properly, leading to networking issues within the cluster.

You can temporarily fix this issue by redeploying all the calico pods.

kubectl delete pods -n kube-system -l k8s-app=calico-node

Once the calico pods are restarted, you you shouldn’t see the error.

Also, if your pods in ContainerCreating state, you need to restart or repdeploy the pods once to make it running.

πŸ’‘
To solve this issue permanently, increase the cluster CPU and memory resources by adding more nodes.