KCNA Kubernetes Fundamentals Practice Question
A DevOps engineer has created a ConfigMap named 'app-config' with some configuration data. They want to make that data available as environment variables in a pod. Which field in the pod spec should they use to achieve this?
⚠ Common exam trap
A common mix-up: candidates confuse `envFrom` with `env` or `volumeMounts`, thinking that mounting a ConfigMap as a volume or using individual `env` entries is the only way to expose its data, but `envFrom` is the specific field designed for bulk injection of ConfigMap keys as environment variables.
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
✓
spec.containers[].envFrom
The `envFrom` field in the container spec allows you to inject all key-value pairs from a ConfigMap (or Secret) as environment variables into the container. This is the most direct and efficient way to expose ConfigMap data as environment variables without needing to specify each key individually.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
spec.volumes
Why it's wrong here
spec.volumes defines volumes; it does not directly set environment variables.
- ✗
spec.containers[].volumeMounts
Why it's wrong here
volumeMounts is for mounting volumes, not for environment variables.
- ✓
spec.containers[].envFrom
Why this is correct
envFrom takes a list of configMapRef or secretRef to populate environment variables.
- ✗
spec.containers[].env
Why it's wrong here
env sets variables individually — sourcing a value from a ConfigMap via env still requires one explicit valueFrom.configMapKeyRef entry per key you want. envFrom takes a single configMapRef and automatically creates an environment variable for every key already in the ConfigMap, with no per-key entries to write.
Go deeper
Related to this question
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 →
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.