Bird
0
0

Which of the following is the correct syntax to select pods with label app=frontend in a Service YAML?

easy📝 Configuration Q12 of 15
Kubernetes - Labels and Selectors
Which of the following is the correct syntax to select pods with label app=frontend in a Service YAML?
Aselector: app: frontend
Bselector: app = frontend
Cselector: app: 'frontend' version: 'v1'
Dselector: - app: frontend
Step-by-Step Solution
Solution:
  1. Step 1: Check YAML selector syntax

    Selectors use key: value pairs without '=' sign or list format.
  2. Step 2: Validate options

    selector: app: frontend uses correct key: value syntax. selector: app = frontend uses '=' which is invalid. selector: app: 'frontend' version: 'v1' adds extra label, which is valid but not asked. selector: - app: frontend uses list format which is invalid for selector.
  3. Final Answer:

    selector: app: frontend -> Option A
  4. Quick Check:

    Selector uses key: value, no '=' or list [OK]
Quick Trick: Use key: value pairs for selectors, no '=' or lists [OK]
Common Mistakes:
  • Using '=' instead of ':' in YAML
  • Writing selectors as lists
  • Adding extra labels not requested

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes