Bird
0
0

Which YAML snippet correctly configures a Service selector to target pods labeled app: web and tier: frontend?

easy📝 Syntax Q3 of 15
Kubernetes - Labels and Selectors
Which YAML snippet correctly configures a Service selector to target pods labeled app: web and tier: frontend?
Aselector: app = web tier = frontend
Bselector: app: web tier: frontend
Cselector: - app: web - tier: frontend
Dselector: app-web tier-frontend
Step-by-Step Solution
Solution:
  1. Step 1: Understand selector syntax

    Selectors use key: value pairs under 'selector' in YAML.
  2. Step 2: Identify correct YAML format

    selector: app: web tier: frontend uses proper YAML mapping syntax for labels.
  3. Final Answer:

    selector: app: web tier: frontend -> Option B
  4. Quick Check:

    YAML selectors require key: value pairs, no equal signs or lists [OK]
Quick Trick: Use key: value pairs under selector, no equals or lists [OK]
Common Mistakes:
  • Using '=' instead of ':' in YAML
  • Listing selectors as arrays
  • Using invalid label keys without colon

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes