Bird
0
0

Given this Pod spec snippet, what will happen if no nodes have label disk=ssd?

medium📝 Command Output Q13 of 15
Kubernetes - Scheduling
Given this Pod spec snippet, what will happen if no nodes have label disk=ssd?
spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: disk
            operator: In
            values:
            - ssd
APod will be scheduled on any node ignoring the label
BPod will remain Pending until a node with <code>disk=ssd</code> is available
CPod will be scheduled on nodes without the label but with enough resources
DPod will be deleted automatically by the scheduler
Step-by-Step Solution
Solution:
  1. Step 1: Understand requiredDuringScheduling nodeAffinity

    This rule means the Pod must be scheduled only on nodes matching the label disk=ssd.
  2. Step 2: Check behavior if no matching nodes exist

    If no nodes have disk=ssd, the Pod cannot be scheduled and stays in Pending state.
  3. Final Answer:

    Pod will remain Pending until a node with disk=ssd is available -> Option B
  4. Quick Check:

    Required nodeAffinity = Pod waits for matching node [OK]
Quick Trick: Required nodeAffinity blocks scheduling if no matching node [OK]
Common Mistakes:
  • Thinking Pod schedules ignoring required nodeAffinity
  • Assuming Pod gets deleted if unschedulable
  • Confusing required and preferred nodeAffinity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes