Bird
0
0

Given this Service selector:

medium📝 Command Output Q13 of 15
Kubernetes - Services
Given this Service selector:
selector:
  tier: backend
  env: prod
Which pods will this Service select?
APods with label <code>tier=backend</code> only
BPods with labels <code>tier=backend</code> and <code>env=prod</code>
CPods with label <code>env=prod</code> only
DPods with either <code>tier=backend</code> or <code>env=prod</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand selector matching logic

    A Service selector matches pods that have all the specified labels with exact values.
  2. Step 2: Apply to given selector

    The selector requires pods to have both tier=backend and env=prod labels to be selected.
  3. Final Answer:

    Pods with labels tier=backend and env=prod -> Option B
  4. Quick Check:

    Selector matches all labels, not any [OK]
Quick Trick: Selector matches pods with all labels, not just one [OK]
Common Mistakes:
  • Thinking selector matches pods with any one label
  • Ignoring one of the labels in selector
  • Confusing OR with AND logic in selectors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes