Bird
0
0

You have this environment variable setup in a pod spec:

medium📝 Troubleshoot Q14 of 15
Kubernetes - Advanced Deployment Patterns
You have this environment variable setup in a pod spec:
- name: FEATURE_Z_ENABLED
  valueFrom:
    configMapKeyRef:
      name: feature-flags
      key: FEATURE_Z_ENABLED

If the ConfigMap 'feature-flags' does not have the key FEATURE_Z_ENABLED, what will happen when the pod starts?
APod will fail to start with an error
BPod will start with FEATURE_Z_ENABLED set to an empty string
CPod will start with FEATURE_Z_ENABLED set to null
DPod will ignore the environment variable
Step-by-Step Solution
Solution:
  1. Step 1: Understand configMapKeyRef behavior

    If the specified key is missing in the ConfigMap, Kubernetes treats it as an error.
  2. Step 2: Effect on pod startup

    The pod will fail to start because the environment variable cannot be resolved from the ConfigMap key.
  3. Final Answer:

    Pod will fail to start with an error -> Option A
  4. Quick Check:

    Missing ConfigMap key causes pod start failure [OK]
Quick Trick: Missing ConfigMap key breaks pod start [OK]
Common Mistakes:
  • Assuming empty string or null is set silently
  • Thinking pod ignores missing keys
  • Confusing with optional environment variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes