Bird
0
0

How can you ensure a ReplicaSet only manages pods with label app=web and env=prod?

hard📝 Application Q9 of 15
Kubernetes - ReplicaSets and Deployments
How can you ensure a ReplicaSet only manages pods with label app=web and env=prod?
ASet selector.matchLabels to {app: web} only and pod template labels to {env: prod}
BSet selector.matchLabels to {app: web, env: prod} but pod template labels to {app: web}
CSet selector.matchLabels to {env: prod} only and pod template labels to {app: web}
DSet selector.matchLabels to {app: web, env: prod} and pod template labels the same
Step-by-Step Solution
Solution:
  1. Step 1: Match all labels in selector and pod template

    The selector must include both labels and pod template must have the same labels.
  2. Step 2: Check mismatches

    If pod labels miss any selector label, ReplicaSet will not manage pods correctly.
  3. Final Answer:

    Set selector and pod template labels both to {app: web, env: prod} -> Option D
  4. Quick Check:

    Selector and pod labels must match exactly [OK]
Quick Trick: Selector and pod labels must be identical sets [OK]
Common Mistakes:
  • Partial label matching between selector and pods
  • Assuming pod labels can differ from selector
  • Ignoring one of the required labels

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes