A pod fails with `CreateContainerConfigError` and a missing key. What happened?
BeginnerScenarioConfiguration, Secrets and storage
Answer
Situation read → Event says couldn't find key DB_HOST in ConfigMap default/app-config.
What I'd do →
kubectl describe podand read the messagekubectl get cm app-config -o yamlto see actual keys- Fix the key name or add the key
- Use
optional: trueonly if the value is truly optional - Re-create the pod or let the Deployment retry
Why → The kubelet cannot build the container environment when a referenced key or object is missing.
Interview tip → Same error appears for missing Secrets.
More on Configuration, Secrets and storage
How do you inject configuration into pods and what are the options?BeginnerA ConfigMap was updated but the pod still shows old values. Why?IntermediateHow do you store a database password safely in Kubernetes?BeginnerHow do you manage secrets in GitOps without committing them in plain text?IntermediateWhat is the difference between emptyDir, hostPath, PV/PVC and when do you use each?BeginnerA StatefulSet's PVC stays Pending. How do you debug?Intermediate