Kubernetes pods show ImagePullBackOff when pulling image from private registry after credential rotation
Environment
Kubernetes cluster using imagePullSecrets referenced in deployments; private registry uses basic auth with a Docker config JSON stored as a kubernetes.io/dockerconfigjson secret. Registry uses TLS with internal CA.
Symptoms
kubectl get pods shows ImagePullBackOff. kubectl describe pod shows events mentioning Failed to pull image and unauthorized or x509 errors. Deployment was working before credential rotation.
Observations
The secret exists in the namespace, but after rotating registry credentials and recreating secret, pods still fail. docker pull from a bastion using new creds succeeds when logged in manually, but kubelet nodes still report errors. ServiceAccount may not reference the updated secret.
Already attempted
Reapplied deployment YAML and restarted kubelet on a single node. Recreated imagePullSecret with kubectl create secret docker-registry. Tried docker login from node rootless and manually pulled the image (success). Pods still show ImagePullBackOff.
Diagnostic steps
- Describe the pod to read the pull error: kubectl describe pod <pod> -n <ns> and look under Events for 'Failed to pull image' messages and exact error text.
- What the result means: If error mentions 'unauthorized' or 'denied', credentials are wrong or not provided. If error mentions x509 or certificate names, it's a TLS trust problem on the node.
- Check secret and its annotation: kubectl get secret <secret-name> -n <ns> -o yaml and confirm type: kubernetes.io/dockerconfigjson and data['.dockerconfigjson'] present. Also verify the pod spec uses imagePullSecrets or the serviceAccount references the secret.
- What the result means: If secret missing or wrong type, recreate with kubectl create secret docker-registry and ensure it's in the same namespace. If pod/serviceAccount not referencing it, add the reference and redeploy.
- On a node that attempted the pull, try docker pull <registry>/<image>:tag (or crictl pull for containerd) after logging into the registry using the same credentials: docker login <registry> && docker pull ...
- What the result means: If manual pull succeeds, node can reach the registry and credentials are correct for that node. If manual pull fails with TLS errors, address CA/trust on nodes.
- Verify serviceAccount binding: kubectl get serviceaccount <sa> -n <ns> -o yaml and confirm imagePullSecrets includes the secret. Also check default serviceAccount if pod doesn't specify one.
- What the result means: If serviceAccount lacks the secret, pods using it won't receive credentials. Adding the secret to the serviceAccount and recreating pods resolves the binding.
- Check node kubelet logs for image pull errors: sudo journalctl -u kubelet --since '10m' | grep -i 'pull' or check container runtime logs (containerd/cri) for pull errors.
- What the result means: Node logs often contain detailed TLS or auth errors that help decide whether the fix is secret, CA distribution, or node-level cache needing kubelet/containerd restart.
Confirmed fixes
No fix has been independently verified for this scenario. Treat the causes below as diagnostic hypotheses.
Question
How to determine whether Kubernetes is using the updated secret, whether nodes trust the registry TLS chain, and how to safely restore image pulls cluster-wide?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Virtualization41% match
Kubernetes pods ImagePullBackOff after rotating registry credentials: namespace secret exists but serviceaccount not bound
Open0 answers - Cloud Computing22% match
Kubernetes pods OOMKilled while node shows 80GB free memory on Ubuntu 20.04 (kubelet+Docker cgroup mismatch suspected)
Open0 answers - Cloud Computing21% match
Kubernetes nodes fail to pull container images after containerd overlay storage filled on GKE-like cluster
Open0 answers