Question 508 of 991
Application Environment, Configuration and SecuritymediumMultiple SelectObjective-mapped

Quick Answer

The answer is both envFrom with secretRef and env with valueFrom.secretKeyRef. The envFrom approach injects all key-value pairs from a Secret as environment variables in one declaration, while secretKeyRef under a container’s env definition targets a single specific key from a Secret. On the CKAD exam, this distinction tests your ability to choose between bulk injection and selective exposure—a common trap is assuming envFrom is the only method, when in fact secretKeyRef is the precise tool for referencing one key. Remember the mnemonic: “From for all, Ref for one”—envFrom pulls the entire Secret, secretKeyRef references a single key.

CKAD Practice Question: Application Environment, Configuration and Security

This CKAD practice question tests your understanding of application environment, configuration and security. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Which TWO approaches can be used to expose a Secret's value as an environment variable in a pod?

Question 1mediummulti select
Full question →

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

env: - name: MY_SECRET valueFrom: secretKeyRef: name: my-secret key: my-key

Option A is correct because the `valueFrom.secretKeyRef` field in a container's `env` definition directly references a specific key from a Kubernetes Secret and injects its value as an environment variable. This is the standard method for exposing a single secret key as an environment variable, as defined in the Kubernetes API.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • env: - name: MY_SECRET valueFrom: secretKeyRef: name: my-secret key: my-key

    Why this is correct

    Correct use of secretKeyRef.

    Related concept

    Read the scenario before looking for a memorised answer.

  • volumeMounts: - name: secret-volume mountPath: /etc/secret

    Why it's wrong here

    This mounts as a volume, not env var.

  • envFrom: - secretRef: name: my-secret

    Why this is correct

    Correct use of envFrom with secretRef.

    Related concept

    Read the scenario before looking for a memorised answer.

  • env: - name: MY_SECRET value: "$(MY_SECRET)"

    Why it's wrong here

    Not a valid way to reference a secret.

  • env: - name: MY_SECRET valueFrom: configMapKeyRef: name: my-secret key: my-key

    Why it's wrong here

    configMapKeyRef cannot reference Secrets.

Common exam traps

Common exam trap: answer the scenario, not the keyword

CNCF often tests the distinction between `secretKeyRef` (for individual keys) and `secretRef` (for all keys via `envFrom`), and the trap here is that candidates may confuse `configMapKeyRef` with `secretKeyRef` or think that `volumeMounts` can expose secrets as environment variables.

Detailed technical explanation

How to think about this question

When using `envFrom` with `secretRef` (Option C), all keys from the referenced Secret become environment variables in the container, with the key name as the variable name. This is convenient for injecting many secrets at once but can lead to naming collisions if multiple secrets have the same key. Under the hood, Kubernetes decodes the base64-encoded secret data and injects the plaintext value into the environment, which is then visible to any process running in the container.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related CKAD practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free CKAD practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this CKAD question test?

Application Environment, Configuration and Security — This question tests Application Environment, Configuration and Security — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: env: - name: MY_SECRET valueFrom: secretKeyRef: name: my-secret key: my-key — Option A is correct because the `valueFrom.secretKeyRef` field in a container's `env` definition directly references a specific key from a Kubernetes Secret and injects its value as an environment variable. This is the standard method for exposing a single secret key as an environment variable, as defined in the Kubernetes API.

What should I do if I get this CKAD question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This CKAD 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 CKAD exam.