Bird
0
0

Which of the following is the correct way to specify a DaemonSet selector in the YAML manifest?

easy📝 Configuration Q12 of 15
Kubernetes - Scheduling
Which of the following is the correct way to specify a DaemonSet selector in the YAML manifest?
Aselector: labels: app: my-daemon
Bselector: matchLabels: app: my-daemon
Cselector: matchExpressions: - key: app operator: Equals values: [my-daemon]
Dselector: matchLabels: app: my-daemon matchExpressions: - key: tier operator: In values: [backend]
Step-by-Step Solution
Solution:
  1. Step 1: Recall DaemonSet selector syntax

    The selector must use matchLabels or matchExpressions under selector.
  2. Step 2: Identify correct syntax

    selector: matchLabels: app: my-daemon uses matchLabels correctly with key-value pairs. selector: labels: app: my-daemon is invalid because it uses labels instead of matchLabels. selector: matchExpressions: - key: app operator: Equals values: [my-daemon] has wrong operator case and structure. selector: matchLabels: app: my-daemon matchExpressions: - key: tier operator: In values: [backend] mixes both but DaemonSet selector only supports one selector type.
  3. Final Answer:

    selector: matchLabels: app: my-daemon -> Option B
  4. Quick Check:

    DaemonSet selector uses matchLabels [OK]
Quick Trick: Use matchLabels under selector for DaemonSet [OK]
Common Mistakes:
  • Using 'labels' instead of 'matchLabels'
  • Incorrect operator casing in matchExpressions
  • Mixing matchLabels and matchExpressions in selector

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes