Kubernetes pods ImagePullBackOff after rotating registry credentials: namespace secret exists but serviceaccount not bound
Environment
Kubernetes 1.22 cluster on managed control plane; private Docker registry requiring dockerconfigjson pushed to namespace as a secret. A credential rotation ran and new secret created; pods now report ImagePullBackOff.
Symptoms
New pod creations immediately fail with ImagePullBackOff and 'pull access denied' in events. kubectl describe pod shows image pull error from registry. Existing running pods continue to run until restarted.
Observations
kubectl get secret -n app ns-registry-secret shows data.dockerconfigjson present. The deployment spec does not reference imagePullSecrets, and the namespace default serviceaccount had the old imagePullSecrets annotation before rotation. ServiceAccount shows no imagePullSecrets entries. Manual kubectl create secret docker-registry and then restarting pods did not fix; recreating pods with imagePullSecrets set in pod spec pulls fine.
Already attempted
Tried adding imagePullSecrets to Deployment spec and force-redeploy; that fixed new pods. Tried patching the default serviceaccount to include imagePullSecrets but pods still failed until the serviceaccount token got refreshed (recreation helped).
Question
What's the safest way to rotate registry credentials across a namespace so existing and new pods can be pulled without manual edits to every Deployment? How to ensure serviceaccount bindings pick up the new secret immediately?
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
- Cloud Computing43% match
Kubernetes pods show ImagePullBackOff when pulling image from private registry after credential rotation
Open0 answers - Cloud Computing21% match
Kubernetes deployment stuck in CrashLoopBackOff immediately after rollout
Open1 answer - Cloud Computing21% match
Kubernetes pods OOMKilled while node shows 80GB free memory on Ubuntu 20.04 (kubelet+Docker cgroup mismatch suspected)
Open0 answers