Bird
0
0

What does kubectl get pods --selector=app=nginx display?

medium📝 Command Output Q5 of 15
Kubernetes - kubectl Essential Commands
What does kubectl get pods --selector=app=nginx display?
ADeletes pods with label app=nginx
BLists pods with label app=nginx
CLists all pods ignoring labels
DShows logs of pods with label app=nginx
Step-by-Step Solution
Solution:
  1. Step 1: Understand the --selector flag

    The --selector flag filters resources by label.
  2. Step 2: Apply selector to pods

    kubectl get pods --selector=app=nginx lists pods labeled with app=nginx.
  3. Final Answer:

    Lists pods with label app=nginx -> Option B
  4. Quick Check:

    kubectl get pods --selector=label = filtered pods [OK]
Quick Trick: Use --selector to filter resources by label [OK]
Common Mistakes:
  • Confusing selector with deleting or logging
  • Using wrong syntax for label filtering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes