Bird
0
0

Which of the following is the correct syntax for selecting pods with label 'app' in either 'web' or 'api'?

easy📝 Syntax Q3 of 15
Kubernetes - Labels and Selectors
Which of the following is the correct syntax for selecting pods with label 'app' in either 'web' or 'api'?
Aapp in (web, api)
Bapp = (web, api)
Capp in web, api
Dapp==web || app==api
Step-by-Step Solution
Solution:
  1. Step 1: Understand set-based selector syntax

    The correct syntax for selecting labels with values in a set is key in (value1, value2).
  2. Step 2: Validate options

    app in (web, api) uses correct syntax. The other options are invalid or incorrect Kubernetes label selector syntax.
  3. Final Answer:

    app in (web, api) -> Option A
  4. Quick Check:

    Set-based selector uses 'in' with parentheses [OK]
Quick Trick: Use 'in (val1, val2)' for set-based label selection [OK]
Common Mistakes:
  • Using '=' instead of 'in'
  • Omitting parentheses
  • Using logical operators like '||' which are invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes