KCNA Kubernetes Fundamentals Practice Question
An application requires a unique identifier per replica, stored in an environment variable. Which Kubernetes resource should be used to inject this identifier into each pod without manual updates?
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
✓
StatefulSet with an environment variable derived from the pod name.
A StatefulSet provides stable, unique network identities and ordered pod naming (e.g., pod-0, pod-1). The pod name can be exposed as an environment variable using the Downward API or Kubernetes hostname field, giving each replica a unique identifier without manual updates. Deployments create identical pods with no ordering, DaemonSets run one pod per node, and Jobs are for batch processing, so only a StatefulSet meets the requirement.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Deployment with pod anti-affinity to schedule each pod on a different node.
Why it's wrong here
Anti-affinity doesn't provide unique identifiers.
- ✓
StatefulSet with an environment variable derived from the pod name.
Why this is correct
StatefulSet pods have stable, unique names (e.g., myapp-0).
- ✗
DaemonSet with a node name environment variable.
Why it's wrong here
DaemonSet pods are per node, not per replica.
- ✗
Job with a completion index environment variable.
Why it's wrong here
Jobs are for run-to-completion, not long-running services.
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.