Bird
0
0

You want to delete all pods in the namespace dev with label tier=backend. Which command correctly does this?

hard📝 Best Practice Q15 of 15
Kubernetes - Pods
You want to delete all pods in the namespace dev with label tier=backend. Which command correctly does this?
Akubectl delete pod -n dev --label tier=backend
Bkubectl delete pods --namespace=dev --label tier=backend
Ckubectl delete pod --namespace dev --selector tier backend
Dkubectl delete pod -n dev --selector tier=backend
Step-by-Step Solution
Solution:
  1. Step 1: Use correct flags for namespace and label selector

    The short flag for namespace is -n and for label selector is --selector or -l.
  2. Step 2: Form the correct command

    The correct command is kubectl delete pod -n dev --selector tier=backend.
  3. Step 3: Check other options for errors

    A uses invalid --label flag. B uses plural pods and invalid --label. C has invalid selector syntax --selector tier backend missing =.
  4. Final Answer:

    kubectl delete pod -n dev --selector tier=backend -> Option D
  5. Quick Check:

    Namespace and label selector flags combined correctly = kubectl delete pod -n dev --selector tier=backend [OK]
Quick Trick: Use '-n' for namespace and '--selector' for labels to delete pods [OK]
Common Mistakes:
  • Using plural 'pods' instead of 'pod'
  • Wrong flag syntax like '--label' or missing '='
  • Mixing long and short flags incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes