`CreateContainerConfigError` with `Error: couldn't find key DB_PASSWORD in Secret payments/db-creds`.
BeginnerTroubleshootingPod startup failures
Answer
Likely causes → The Secret exists but the key name differs (db_password vs DB_PASSWORD, trailing newline in a filename-derived key, or --from-file used so the key is the filename).
Diagnose →
kubectl get secret db-creds -n payments -o jsonpath='{.data}' | jq 'keys'
Fix → Rename the key in the Secret or the reference in the Pod spec. If the key is genuinely optional, mark it:
valueFrom:
secretKeyRef: {name: db-creds, key: DB_PASSWORD, optional: true}
Prevent → Keep a schema of required keys per app and validate it in CI, or generate Secrets from the same template the app reads.
More on Pod startup failures
A Pod shows `CrashLoopBackOff` with `RESTARTS 7` and events say `Back-off restarting failed container app`. Where do you start?Beginner`kubectl logs web-0 --previous` returns nothing useful and the container dies in under a second. How do you get inside it?IntermediatePod status is `ImagePullBackOff` and events show `Failed to pull image "registry.example.com/web:1.4.2": rpc error: code = NotFound desc = failed to pull and unpack image ... not found`.BeginnerEvents show `pull access denied for registry.example.com/web, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed`.BeginnerPulls from Docker Hub randomly fail with `toomanyrequests: You have reached your pull rate limit`.IntermediateA private registry with an internal CA fails with `x509: certificate signed by unknown authority` during image pull.Intermediate