Interview Prep/Kubernetes/Pod startup failures

`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.

All Kubernetes questions Roadmap: Kubernetes core

More on Pod startup failures