Bird
0
0

Given this Pod spec snippet, what will be the value of environment variable DB_PASSWORD inside the container?

medium📝 Command Output Q13 of 15
Kubernetes - Secrets
Given this Pod spec snippet, what will be the value of environment variable DB_PASSWORD inside the container?
env:
- name: DB_PASSWORD
  valueFrom:
    secretKeyRef:
      name: db-secret
      key: password

Assuming the Secret db-secret has the key password with value supersecret123.
Adb-secret
BDB_PASSWORD
Cpassword
Dsupersecret123
Step-by-Step Solution
Solution:
  1. Step 1: Understand valueFrom.secretKeyRef usage

    The environment variable gets its value from the Secret named db-secret and key password.
  2. Step 2: Check Secret key value

    The Secret key password holds the value supersecret123, so that is assigned to DB_PASSWORD.
  3. Final Answer:

    supersecret123 -> Option D
  4. Quick Check:

    Env var gets Secret key's value = B [OK]
Quick Trick: Env var equals Secret's key value, not name or key name [OK]
Common Mistakes:
  • Using Secret name as value
  • Using key name as value
  • Confusing env var name with Secret key

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes