Kubernetes: CreateContainerConfigError — secret / configmap not found
Kubernetes can’t build the container’s configuration — usually a referenced Secret, ConfigMap or key doesn’t exist in that namespace.
secret not foundconfigmap not foundcouldn't find keycontainer has runAsNonRoot and image will run as root Meaning
Environment variables and volumes from Secrets/ConfigMaps are resolved before the container starts. A missing object or key (or a wrong namespace) stops it here — the app never runs, so there are no app logs.
Common causes
- Secret/ConfigMap not created (or created in another namespace)
- Key name typo in
secretKeyRef/configMapKeyRef - Deployment applied before its secrets in CI
- runAsNonRoot set but the image runs as root
⚡ Quick fix
kubectl describe pod→ Events names the missing object/key- Create it in the same namespace
- Use
optional: truefor truly optional keys - Order manifests so secrets apply first
Detailed fix by platform
Kubernetes
- Check and create:bash
kubectl -n prod get secret api-secrets -o jsonpath='{.data}' | head -c 300 kubectl -n prod create secret generic api-secrets --from-literal=DATABASE_URL='postgres://…'
How to diagnose
- Events — Which secret/configmap/key is missing?
- Namespace — Same namespace as the pod?
- Keys — Exact key names?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Kubernetes
- error converting YAML to JSON error converting YAML to JSON: yaml: line 12: did not find expected key
- FailedCreatePodSandBox Failed to create pod sandbox: plugin type="calico" failed (add): ... (FailedCreatePodSandBox)
- unknown field strict decoding error: unknown field "spec.template.spec.containers[0].ports[0].protocl"
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026