Kubernetes Private Registry & imagePullSecrets Debug Prompt
Diagnose pods failing to pull from a private registry, covering dockerconfigjson secrets, ServiceAccount-attached pull secrets, and registry auth across namespaces.
- Target user
- Engineers wiring up private container registries
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who has fixed countless `ErrImagePull: unauthorized` events that turned out to be a pull secret in the wrong namespace or never attached at all. I will provide: - The registry (ECR, GCR/GAR, GHCR, Harbor, Docker Hub private) and image reference - The pod/Deployment spec and which namespace it runs in - How the pull secret was created and where it's referenced Your job: 1. **Read the event** — interpret `kubectl describe pod` events: distinguish `ErrImagePull`/`ImagePullBackOff` due to auth (`401 unauthorized`) vs a wrong tag (`manifest unknown`) vs network/registry-unreachable. 2. **Verify the secret** — confirm a `kubernetes.io/dockerconfigjson` secret exists in the *same namespace* as the pod (secrets are namespaced; one in default won't help kube-system) and decode it to check the registry host and auth match. 3. **Confirm attachment** — check the pod actually references it via `spec.imagePullSecrets` or via the pod's ServiceAccount `imagePullSecrets`; a secret that exists but isn't referenced does nothing. 4. **Registry-specific auth** — for ECR, note tokens expire (~12h) and need a refresh mechanism or IRSA; for GHCR, the PAT needs `read:packages`; for GAR, Workload Identity vs key file. 5. **Reproduce manually** — pull the image from a debug pod or node with the same creds to isolate cluster config from registry-side problems. 6. **Fix and harden** — attach the secret to the ServiceAccount so future pods inherit it, and document rotation. Output as: (a) the diagnostic command sequence, (b) the corrected secret + ServiceAccount/pod reference, (c) a registry-specific notes table, (d) the top 3 root causes for this symptom. Do not paste decoded registry credentials into shared logs or tickets — redact the auth token when sharing diagnostics.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
kubectl port-forward Connection Failure Debug Prompt
Diagnose why kubectl port-forward drops, refuses, or hangs — pod not Ready, wrong target port, SPDY/websocket proxy issues, or an app bound to localhost inside the container — instead of guessing.
-
metrics-server Unavailable and kubectl top Failure Debug Prompt
Fix 'metrics not available' / 'error: Metrics API not available' when kubectl top and HPAs stop working — diagnose the APIService, TLS/kubelet connectivity, and metrics-server flags instead of restarting blindly.
-
CrashLoopBackOff Triage From Describe and Logs Prompt
Walk a CrashLoopBackOff pod from kubectl describe, previous-container logs, and exit codes to a precise root cause and fix, instead of blindly restarting it.
-
Pending Pod Scheduling Diagnosis Prompt
Diagnose why a pod is stuck Pending by reading scheduler events, node capacity, and the pod's scheduling constraints, then propose the minimal change to get it scheduled.
More Kubernetes & Helm prompts & error guides
Browse every Kubernetes & Helm prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.