A referenced ConfigMap was not found
Production Risk
The application cannot start, leading to a service outage or deployment failure. It is a hard dependency failure.
A pod is trying to start but fails because it references a ConfigMap that does not exist. This prevents the container from being configured and started.
- 1The ConfigMap was never created
- 2The ConfigMap was created in the wrong namespace
- 3A typo in the ConfigMap name within the pod specification
A pod fails to start, and describing the pod shows a 'CreateContainerConfigError' with a message saying 'configmap not found'.
kubectl describe pod my-app-pod
expected output
Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning Failed 30s (x4 over 90s) kubelet Error: CreateContainerConfigError: configmap "my-app-config" not found
Fix 1
Verify the ConfigMap exists in the correct namespace
WHEN The pod cannot find its required ConfigMap
kubectl get configmap my-app-config -n my-namespace
Why this works
This command attempts to retrieve the specified ConfigMap from the pod's namespace. If it fails, the ConfigMap needs to be created or the pod spec needs to be corrected.
Fix 2
Create the missing ConfigMap
WHEN The ConfigMap does not exist
kubectl create configmap my-app-config --from-literal=key1=value1 -n my-namespace
Why this works
Creates a new ConfigMap with the given name and data in the specified namespace, resolving the dependency for the pod.
✕ Mark the ConfigMap as optional in the pod spec
While this will allow the pod to start, the application will likely crash if it requires the configuration that is now missing. It masks the root problem.
k8s.io/kubernetes/pkg/kubelet/kubelet_pods.go
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev