A new deployment went into CrashLoopBackOff immediately after kubectl apply. Running kubectl logs showed the app dying on startup with: Error: config file not found at /etc/app/config.yaml.
Root cause:
The ConfigMap (app-config) had been created in the default namespace, but the deployment was running in the production namespace. Kubernetes ConfigMaps are namespace-scoped — the pod couldn't find the ConfigMap, so the mounted file simply didn't exist at startup.
Fix:
First, find where the ConfigMap actually lives:
kubectl get configmap -A | grep app-config
# Output: default app-config 1 5mRecreate it in the correct namespace:
# Export from default namespace
kubectl get configmap app-config -n default -o yaml \
| sed 's/namespace: default/namespace: production/' \
| kubectl apply -f -
# Verify it's in the right place
kubectl get configmap app-config -n productionThen restart the deployment:
kubectl rollout restart deployment my-app -n production
kubectl rollout status deployment my-app -n productionCheck that the pod starts cleanly:
kubectl logs -n production -l app=my-app --tail=20Lesson: When a pod can't find a mounted ConfigMap or Secret, always run kubectl get configmap -A | grep <name> first — it's almost always a namespace mismatch, not a missing resource.