Bird
0
0

If you run kubectl get pods -l app=web,env=dev, which pods will be listed given:

medium📝 Command Output Q5 of 15
Kubernetes - Labels and Selectors
If you run kubectl get pods -l app=web,env=dev, which pods will be listed given:
pod1: app=web, env=prod
pod2: app=web, env=dev
pod3: app=db, env=dev
Apod1 and pod2
Bpod2 only
Cpod2 and pod3
Dpod1, pod2, and pod3
Step-by-Step Solution
Solution:
  1. Step 1: Analyze label selector

    The selector requires both 'app=web' and 'env=dev'.
  2. Step 2: Check pods against selector

    pod2 matches both labels; pod1 and pod3 do not.
  3. Final Answer:

    pod2 only -> Option B
  4. Quick Check:

    Multiple label selectors require all labels matched = A [OK]
Quick Trick: Multiple labels in selector mean AND condition [OK]
Common Mistakes:
  • Assuming OR condition between labels
  • Selecting pods missing one label
  • Ignoring label key-value pairs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes