Courseiva
Workloads and Scheduling →hardMultiple Select

CKA Workloads and Scheduling Practice Question

Which two scheduling constraints can be used to ensure a pod runs on a node that has a specific label?

⚠ Common exam trap

The CKA exam often tests the distinction between hard constraints (`nodeSelector` and `requiredDuringSchedulingIgnoredDuringExecution` in `nodeAffinity`) and soft preferences (`preferredDuringSchedulingIgnoredDuringExecution`). It also tests the difference between node affinity (which matches node labels) and tolerations (which match node taints).

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

✓

requiredDuringSchedulingIgnoredDuringExecution in nodeAffinity

Option B (requiredDuringSchedulingIgnoredDuringExecution in nodeAffinity) is correct because it is a hard node affinity rule that forces the scheduler to place the pod only on nodes matching the specified label selector (e.g., matchExpressions or matchFields), so the pod will not be scheduled unless a node with that label exists. Option D (nodeSelector) is correct because it is the simplest scheduling constraint: the pod spec's nodeSelector field is a map of key-value pairs that must all match the node's labels for the pod to be scheduled there. Option A (topologySpreadConstraints) is not correct here because it controls how pods are distributed across topology domains (such as zones or hostnames) rather than requiring a specific node label. Option C (tolerations) is not correct because tolerations only allow a pod to be scheduled onto nodes with matching taints; they do not select nodes by label. Option E (preferredDuringSchedulingIgnoredDuringExecution) is not correct because it is a soft affinity preference that the scheduler tries to honor but can ignore, so it cannot ensure the pod runs on a specifically labeled 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.

  • ✗

    topologySpreadConstraints

    Why it's wrong here

    topologySpreadConstraints distribute replicas evenly across topology domains such as zones or nodes; they do not require a node to carry a specific label. They are tempting because they reference node labels via topologyKey, but that key defines the spread domain, not a placement filter, so they would be correct for balancing availability, not label-based targeting.

  • ✓

    requiredDuringSchedulingIgnoredDuringExecution in nodeAffinity

    Why this is correct

    The `requiredDuringSchedulingIgnoredDuringExecution` nodeAffinity rule enforces a hard constraint: the scheduler only places the pod on nodes matching the specified label selector, and the pod stays pending otherwise. This satisfies the stem's demand for a scheduling constraint guaranteeing placement on a labelled node, unlike preferred rules which merely bias scoring.

  • ✗

    tolerations

    Why it's wrong here

    Tolerations let a pod tolerate a node's taints; they do not select nodes by label. They are tempting because they influence scheduling decisions and pair with node affinity in taint-and-toleration designs, but they would be correct when repelling workloads from dedicated nodes, not when pinning a pod to a labelled node.

  • ✓

    nodeSelector

    Why this is correct

    nodeSelector matches pod scheduling directly against node labels, satisfying the requirement to place a pod only on nodes carrying a specific label. It uses the `spec.nodeSelector` field with exact key-value pairs, and the scheduler filters out any node lacking a matching label. This is the simplest label-based constraint available.

  • ✗

    preferredDuringSchedulingIgnoredDuringExecution

    Why it's wrong here

    preferredDuringSchedulingIgnoredDuringExecution only expresses a soft preference, so the scheduler may place the pod on a node lacking the required label when no matching node is available. It is tempting because it does target node labels, and it would be correct where placement is desirable but not mandatory, unlike requiredDuringSchedulingIgnoredDuringExecution.

About these practice questions

This CKA question is part of Courseiva's 726-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 CKA 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 CKA exam.