Bird
0
0

You want to update environment variables in a running pod without rebuilding the container image. Which approach using ConfigMaps is correct?

hard📝 Workflow Q15 of 15
Kubernetes - ConfigMaps
You want to update environment variables in a running pod without rebuilding the container image. Which approach using ConfigMaps is correct?
AUse a Secret instead of ConfigMap for environment variables
BModify the container image to include new environment variables
CCreate or update a ConfigMap and reference it with <code>envFrom</code> in the pod spec, then restart the pod
DEdit the pod spec to add environment variables directly and redeploy the image
Step-by-Step Solution
Solution:
  1. Step 1: Understand ConfigMap update workflow

    ConfigMaps allow updating config data separately; updating the ConfigMap and restarting the pod applies new env vars without rebuilding images.
  2. Step 2: Evaluate options for best practice

    Create or update a ConfigMap and reference it with envFrom in the pod spec, then restart the pod correctly uses ConfigMap with envFrom and pod restart. Others require image rebuild or confuse Secrets with ConfigMaps.
  3. Final Answer:

    Create or update a ConfigMap and reference it with envFrom in the pod spec, then restart the pod -> Option C
  4. Quick Check:

    Update ConfigMap + restart pod for new env vars [OK]
Quick Trick: Update ConfigMap and restart pod, no image rebuild needed [OK]
Common Mistakes:
  • Rebuilding container image unnecessarily
  • Confusing Secrets with ConfigMaps for non-sensitive data
  • Editing pod spec without restarting pod

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes