Troubleshooting guide
CreateContainerConfigError in Kubernetes: how to fix it
CreateContainerConfigError means Kubernetes could not assemble the container's configuration. Nearly always, a referenced Secret or ConfigMap, or one of its keys, is missing.
3 min read9 sectionsUpdated
On this page
Common causes
- A Secret or ConfigMap that does not exist in the pod's namespace.
- A key that does not exist inside it, often through a typo or differing case.
- Deployment order. The workload was applied before its secret.
- An external secrets operator that failed to sync.
runAsNonRootwith an image that runs as root, which gives a similar configuration error.
Diagnose it
The event tells you exactly what is absent. Then compare the keys that exist with those requested.
# The reason, in plain words
kubectl describe pod my-pod | grep -A3 CreateContainerConfigError
# What exists in this namespace?
kubectl get secret,configmap -n prod
# Key names (not values) in a secret
kubectl get secret app-secrets -n prod -o json | python3 -c "import sys,json; print(list(json.load(sys.stdin)['data']))"
# What the pod references
kubectl get pod my-pod -n prod -o yaml | grep -A3 -E 'secretKeyRef|configMapKeyRef|secretRef'Fixes
Create the missing object in the right namespace, or correct the reference, and the kubelet picks it up on its next retry. Deploy configuration before workloads, using Helm hooks or ordering in your tooling. Check the status of ExternalSecret resources if you use an operator. Use optional: true on a reference only when the application truly works without the value, because otherwise you swap a clear error for a confusing runtime failure.
Catch it automatically
Add a validation step to your pipeline that checks every referenced Secret and ConfigMap exists in the target namespace. Alert on pods waiting in this state, as your Kubernetes monitoring can read waiting reasons directly. A blocked rollout otherwise waits silently.
Does the pod retry automatically?
Yes. Once the Secret or ConfigMap exists, the kubelet starts the container on its next attempt.
Why are there no logs?
The container was never created, so use kubectl describe pod and look at the events.
Can a pod use a Secret from another namespace?
No. Copy it, or use a tool that syncs secrets between namespaces.
Related reading
- 404 Not Found: how to find and fix broken pages: Find and fix 404 errors: broken internal links, moved pages, case-sensitive paths and soft 404s, with commands and advice on what actually affects SEO.
- 501 Not Implemented: how to fix it: Fix 501 Not Implemented: unsupported HTTP methods, servers and proxies that do not support PATCH or WebDAV, and how it differs from 405 and 500.
- ERR_NAME_NOT_RESOLVED: how to fix DNS lookup failures: Fix ERR_NAME_NOT_RESOLVED: missing records, expired domains, broken resolvers and DNSSEC failures, with dig commands that show exactly where lookup fails.
- DNS_PROBE_FINISHED_NXDOMAIN: fix it for your domain: What DNS_PROBE_FINISHED_NXDOMAIN means, how to check your domain and DNS records, the usual causes such as expiry and typos, and how to monitor DNS.
- Kubernetes HPA not scaling: how to fix it: Fix a Kubernetes HorizontalPodAutoscaler that will not scale: unknown metrics, missing CPU requests, metrics-server issues, tolerance and stabilization windows.
- 405 Method Not Allowed: why it happens and how to fix it: Fix 405 Method Not Allowed: POST sent to a static file, redirects that turn POST into GET, CORS preflights and routing mismatches, with curl checks.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.