Courseiva
Kubernetes Fundamentals →mediumMultiple Select

KCNA Kubernetes Fundamentals Practice Question

Which TWO of the following are valid ways to assign a pod to a specific node?

⚠ Common exam trap

CNCF often tests the distinction between mechanisms that *constrain* scheduling (like nodeSelector and nodeAffinity) versus mechanisms that *permit* scheduling (like tolerations), and candidates mistakenly think tolerations can force a pod to a specific node when they only allow it to be scheduled on tainted nodes.

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

Option A (nodeSelector) is correct because it is a field in the pod spec that matches against node labels, causing the scheduler to place the pod only on nodes carrying the specified label key/value pairs. Option D (nodeName) is correct because setting spec.nodeName bypasses the scheduler entirely and directly binds the pod to the named node, which is a valid (if low-level) way to assign a pod to a specific node. Option B (affinity: nodeAntiAffinity) is incorrect because node anti-affinity repels pods from nodes matching certain labels rather than assigning a pod to a specific node. Option C (tolerations) is incorrect because tolerations only allow a pod to be scheduled onto nodes with matching taints; they do not target a specific node. Option E (podSelector) is incorrect because podSelector is used in resources like NetworkPolicy, PodDisruptionBudget, and topology spread constraints to select pods, not to assign a pod to a node.

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 pods to nodes via labels, satisfying the requirement to pin a pod to a specific node. You add a label to the target node, then reference it under `spec.nodeSelector` in the pod manifest; the scheduler only places the pod on nodes carrying that exact label.

  • ✗

    affinity: nodeAntiAffinity

    Why it's wrong here

    nodeAntiAffinity repels pods from nodes matching a label, so it excludes nodes rather than assigning a pod to a specific one. Use nodeAffinity with requiredDuringScheduling to target a node. Anti-affinity is correct for spreading replicas away from each other or from labelled nodes.

  • ✗

    tolerations

    Why it's wrong here

    Tolerations let a pod schedule onto nodes carrying matching taints; they permit placement but never target a specific node. nodeSelector, nodeName, or node affinity perform the assignment. Tolerations are correct when a pod must run on a tainted node, such as a dedicated GPU or control-plane node.

  • ✓

    nodeName

    Why this is correct

    nodeName bypasses the scheduler entirely, binding the pod directly to the named node at creation. It satisfies the requirement to assign a pod to a specific node, though it skips scheduling constraints and label matching.

  • ✗

    podSelector

    Why it's wrong here

    podSelector is a NetworkPolicy and label-matching field, not a scheduling constraint; it selects pods for policy application, not nodes for placement. nodeSelector, nodeName, or node affinity assign pods to nodes. podSelector is correct when scoping which pods a network policy governs.

About these practice questions

Courseiva writes every KCNA question from scratch — 930 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 →

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.