Bird
0
0

If a pod named frontend-pod has a label env=testing, what happens when you run:

medium📝 Command Output Q4 of 15
Kubernetes - Labels and Selectors
If a pod named frontend-pod has a label env=testing, what happens when you run:
kubectl label pod frontend-pod env=production --overwrite?
AThe command is ignored and no changes are made
BAn error occurs because the label <code>env</code> already exists
CA new label <code>env=production</code> is added alongside the existing one
DThe label <code>env</code> is updated to <code>production</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand the --overwrite flag

    This flag allows existing labels with the same key to be updated.
  2. Step 2: Effect on the label

    The existing env=testing label will be replaced with env=production.
  3. Final Answer:

    The label env is updated to production -> Option D
  4. Quick Check:

    --overwrite updates existing labels [OK]
Quick Trick: Use --overwrite to update existing labels [OK]
Common Mistakes:
  • Assuming duplicate labels with same key can coexist
  • Expecting an error without --overwrite

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes