| title | Kubernetes CreateContainerConfigError | |||||
|---|---|---|---|---|---|---|
| slug | kubernetes-createcontainerconfigerror | |||||
| technologies |
|
|||||
| severity | high | |||||
| tags |
|
|||||
| related |
|
|||||
| last_reviewed | 2026-06-27 |
NAME READY STATUS RESTARTS AGE
billing-5c9d7f6b8b-r4tlz 0/1 CreateContainerConfigError 0 47s
Warning Failed 12s (x5 over 47s) kubelet
Error: configmap "billing-config" not found
Warning Failed 9s (x4 over 41s) kubelet
Error: couldn't find key DATABASE_URL in Secret prod/billing-secrets
CreateContainerConfigError means the kubelet successfully pulled the image and
created the pod sandbox, but it cannot assemble the container's configuration
before starting it. This almost always comes from a referenced ConfigMap or
Secret β or a specific key within one β that does not exist. Unlike
CrashLoopBackOff, the container never even starts, so there are no application
logs to read; the answer is entirely in the pod events.
- kubernetes (kubelet)
high β the container cannot be created, so the pod is 0/1 and the workload
has no healthy replica until the missing config object exists.
- A ConfigMap or Secret named in
envFrom,env.valueFrom, or a volume does not exist in the pod's namespace. - The object exists but the specific
keyreferenced is absent. - The ConfigMap/Secret is in a different namespace than the pod (these references are namespace-local).
- A typo in the ConfigMap/Secret name or key.
- The object is created after the pod (ordering issue in a fresh deploy or a GitOps sync race).
Before launching a container, the kubelet resolves every valueFrom,
secretKeyRef, configMapKeyRef, and projected volume into concrete environment
variables and files. If any referenced object or key is missing, the kubelet
cannot build the container's config and aborts container creation with
CreateContainerConfigError, retrying on the standard back-off. Because this
happens at config-assembly time β earlier than process start β the failure is
deterministic and the event names the exact missing object or key.
# The event naming the missing ConfigMap/Secret or key
kubectl describe pod <pod> -n <namespace>
# Which ConfigMaps/Secrets the pod references
kubectl get pod <pod> -n <namespace> -o jsonpath='
{range .spec.containers[*].envFrom[*]}{.configMapRef.name}{.secretRef.name}{"\n"}{end}'
# Confirm whether the named object exists in this namespace
kubectl get configmap,secret -n <namespace>
# Inspect the keys present in the referenced object
kubectl get configmap billing-config -n <namespace> -o jsonpath='{.data}'Error: configmap "billing-config" not found
or
Error: couldn't find key DATABASE_URL in Secret prod/billing-secrets
The first form means the whole object is missing; the second means the object
exists but the key does not. A healthy pod skips this error and proceeds to
ContainerCreating β Running.
-
Create the missing object in the same namespace as the pod:
kubectl create configmap billing-config \ --from-literal=LOG_LEVEL=info -n <namespace>
-
If only a key is missing, add it to the existing object:
kubectl create secret generic billing-secrets \ --from-literal=DATABASE_URL='postgres://...' \ -n <namespace> --dry-run=client -o yaml | kubectl apply -f -
-
Fix any name/key typo in the pod spec to match the actual object.
-
Ensure deploy ordering so ConfigMaps/Secrets are applied before the workload (Helm hooks or GitOps sync waves).
kubectl get pod <pod> -n <namespace> -w
# Expect: status leaves CreateContainerConfigError and reaches Running 1/1.- Validate that every referenced ConfigMap/Secret/key exists in CI (kubeconform +
a custom check, or
kubectl --dry-run=server). - Use
optional: trueonvalueFromreferences that are genuinely optional. - Apply config objects in an earlier sync wave than the workloads that need them.
kubernetes Β· pod Β· configmap Β· secret Β· production