Courseiva
Kubernetes FundamentalsmediumMultiple SelectObjective-mapped

KCNA Kubernetes Fundamentals Practice Question

Which TWO of the following are valid ways to expose environment variables from a ConfigMap to a pod?

⚠ Common exam trap

CNCF often tests the distinction between `configMapKeyRef` and `secretKeyRef`, expecting candidates to know that `secretKeyRef` is for Secrets only, not ConfigMaps, and that `env.value` is for static values, not dynamic references.

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.valueFrom.configMapKeyRef

Environment variables from a ConfigMap can be exposed to a pod using envFrom to inject all key-value pairs as environment variables, or using env.valueFrom.configMapKeyRef to inject a specific key as an environment variable. Using volumes and volumeMounts mounts the ConfigMap as files in the filesystem, not as environment variables. Option B (env.value) is for static values, not references. Option C (secretKeyRef) is for Secrets, not ConfigMaps.

Answer analysis

Option-by-option breakdown

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

  • volumes and volumeMounts

    Why it's wrong here

    Volumes and volumeMounts expose ConfigMap data as files in the filesystem, not as environment variables. This method does not satisfy the requirement for exposing environment variables.

  • env.value

    Why it's wrong here

    env.value is for static values, not dynamic references to ConfigMaps.

  • env.valueFrom.secretKeyRef

    Why it's wrong here

    secretKeyRef is for referencing Secrets, not ConfigMaps. ConfigMaps use configMapKeyRef.

  • env.valueFrom.configMapKeyRef

    Why this is correct

    Correct. env.valueFrom.configMapKeyRef allows referencing a specific key from a ConfigMap and exposing it as an environment variable.

  • envFrom

    Why this is correct

    Correct. envFrom allows injecting all key-value pairs from a ConfigMap as environment variables.

About these practice questions

One of 833 original KCNA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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