Bird
0
0

Given pods with labels:

medium📝 Command Output Q4 of 15
Kubernetes - Labels and Selectors
Given pods with labels:
pod1: app=web, env=prod
pod2: app=api, env=prod
pod3: app=web, env=dev
What pods are selected by app in (web) , env=prod?
Apod2 only
Bpod1 and pod3
Cpod2 and pod3
Dpod1 only
Step-by-Step Solution
Solution:
  1. Step 1: Analyze label selector conditions

    The selector requires app label to be 'web' and env label to be 'prod'.
  2. Step 2: Check pods against conditions

    pod1 has app=web and env=prod, so it matches. pod3 has app=web but env=dev, so no. pod2 has env=prod but app=api, so no.
  3. Final Answer:

    pod1 only -> Option D
  4. Quick Check:

    Both conditions must match = pod1 only [OK]
Quick Trick: Multiple selectors combine with AND logic [OK]
Common Mistakes:
  • Assuming OR logic between selectors
  • Ignoring one of the label conditions
  • Misreading label values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes