Bird
0
0

You wrote this Pod spec to use a Secret as an environment variable but the Pod fails to start:

medium📝 Troubleshoot Q6 of 15
Kubernetes - Secrets
You wrote this Pod spec to use a Secret as an environment variable but the Pod fails to start:
env:
- name: PASSWORD
  valueFrom:
    secretKeyRef:
      name: db-secret
      key: pass

The Secret db-secret exists but the Pod error says key not found. What is the likely problem?
AThe environment variable name PASSWORD is invalid.
BThe Secret name is misspelled in the Pod spec.
CSecrets cannot be used as environment variables.
DThe key name in the Secret is different from 'pass'.
Step-by-Step Solution
Solution:
  1. Step 1: Check Secret key existence

    The error indicates the key 'pass' is missing in the Secret data.
  2. Step 2: Verify key name correctness

    Most likely the key name in the Secret is different or misspelled, causing the error.
  3. Final Answer:

    The key name in the Secret is different from 'pass'. -> Option D
  4. Quick Check:

    Key name mismatch causes key not found error [OK]
Quick Trick: Check Secret key names carefully for typos [OK]
Common Mistakes:
  • Assuming Secret name typo without checking key
  • Thinking env var name causes error
  • Believing Secrets can't be env vars

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes