KCNA Container Orchestration Practice Question
A pod is in the 'CrashLoopBackOff' state. You run 'kubectl logs mypod' and see an error related to missing environment variables. The pod is part of a Deployment. What is the best way to fix this without recreating the entire Deployment?
⚠ Common exam trap
Kubernetes often tests the misconception that you can fix a pod's configuration by editing the pod directly, when in fact the Deployment's controller will replace or reconcile those changes, making a template update the durable fix. Be careful not to confuse editing a pod directly with updating the Deployment's pod template imperatively via `kubectl set env`.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Update the Deployment's pod template to include the missing environment variables
The Deployment's pod template defines the desired state for its ReplicaSet. Updating the template to include the missing environment variables causes the Deployment to perform a rolling update, creating new pods with the correct configuration. This is the declarative, Kubernetes-native approach that maintains the Deployment's lifecycle management. Note that `kubectl set env deployment/<name> KEY=value` is also a valid imperative way to update the Deployment's pod template and trigger the same rolling update; it is not the same as editing the pod directly.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use kubectl set env to add the environment variables to the pod
Why it's wrong here
kubectl set env works on resources like Deployments, but only on the template, not on running pods.
- ✗
Delete the pod and rely on the Deployment to recreate it
Why it's wrong here
Deleting the pod will recreate it with the same configuration, so the problem will persist.
- ✓
Update the Deployment's pod template to include the missing environment variables
Why this is correct
Updating the Deployment's spec triggers a rolling update, creating new pods with the correct environment.
- ✗
Edit the pod directly using kubectl edit pod mypod
Why it's wrong here
Pods in a Deployment are managed by the ReplicaSet; editing the pod directly will not persist if the pod is replaced.
Go deeper
Related to this question
About these practice questions
Courseiva writes every KCNA question from scratch — 930 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This KCNA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the KCNA exam.