Containers get stuck in a state of ImagePullBackOff
or CrashLoopBackOff
and show a detailed error like:
Cannot initialize Kubernetes connection: the server has asked for the client to provide credentialspanic: runtime error: invalid memory address or nil pointer dereference
This is caused by stale credentials within Rancher (rancher/rancher#8388).
The following instructions can be used to fix the issue in the meantime.
Delete the token first.
kubectl -n kube-system describe serviceaccount io-rancher-system
kubectl –n kube-system delete secret <token name>
Then remove the add-ons.
kubectl -n kube-system get pods
Delete Tiller, KubeDNS, Kubernetes Dashboard, and Heapster pods. They'll be recreated and should be able to access the Kubernetes API afterwards.
kubectl -n kube-system delete ...
Thanks ! worked for me :)