KCNA Container Orchestration Practice Question
An application requires that a specific set of pods be placed on nodes labeled with 'gpu=true'. Which Kubernetes field should be used in the pod spec to enforce this?
⚠ Common exam trap
Watch out — candidates often confuse `nodeSelector` with `nodeAffinity`, thinking the more advanced field is always required, but the question specifically asks for the field that enforces placement on labeled nodes, and `nodeSelector` is the simplest and correct answer for a straightforward label match.
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
✓
nodeSelector
`nodeSelector` is the simplest and most direct Kubernetes field for constraining a pod to nodes that have a specific label. By setting `nodeSelector: { gpu: 'true' }` in the pod spec, the scheduler will only place the pod on nodes that have the label `gpu=true`. This is a hard constraint that does not support complex expressions but is ideal for the stated 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.
- ✓
nodeSelector
Why this is correct
nodeSelector matches the pod to nodes that have the specified label (e.g., gpu=true).
- ✗
topologySpreadConstraints
Why it's wrong here
Topology spread constraints control how pods are spread across topology domains, not node selection.
- ✗
affinity.nodeAffinity
Why it's wrong here
Node affinity is more expressive but not the simplest; nodeSelector is the straightforward option.
- ✗
tolerations
Why it's wrong here
Tolerations allow pods to be scheduled on tainted nodes, not to select nodes based on labels.
Go deeper
Related to this question
About these practice questions
Courseiva writes every KCNA question from scratch — 833 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.