Bird
0
0

You want to select pods that have label version set to either v1 or v2, but exclude those with label env=dev. Which selector correctly achieves this?

hard📝 Workflow Q15 of 15
Kubernetes - Labels and Selectors
You want to select pods that have label version set to either v1 or v2, but exclude those with label env=dev. Which selector correctly achieves this?
Aversion = v1 || v2, env != dev
Bversion in (v1, v2) env != dev
Cversion in (v1, v2), env notin (dev)
Dversion in (v1, v2) && env != dev
Step-by-Step Solution
Solution:
  1. Step 1: Use set-based selector for 'version'

    To select pods with version label as v1 or v2, use version in (v1, v2).
  2. Step 2: Use set-based exclusion for 'env'

    To exclude pods with env=dev, use env notin (dev).
  3. Step 3: Combine selectors with comma

    Separate multiple selectors with commas to combine conditions.
  4. Final Answer:

    version in (v1, v2), env notin (dev) -> Option C
  5. Quick Check:

    Combine set-based selectors with commas [OK]
Quick Trick: Combine selectors with commas; use 'in' and 'notin' properly [OK]
Common Mistakes:
  • Using '!=' or '||' which are invalid in selectors
  • Missing commas between selectors
  • Incorrect syntax for set-based selectors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes