Bird
0
0

You want to list all pods in the namespace 'dev' with label 'tier=frontend' showing node and IP. Which command is correct?

hard📝 Workflow Q8 of 15
Kubernetes - kubectl Essential Commands
You want to list all pods in the namespace 'dev' with label 'tier=frontend' showing node and IP. Which command is correct?
Akubectl get pods -n dev --label=tier=frontend -o json
Bkubectl get pods -n dev --selector=tier=frontend -o wide
Ckubectl get pods --all-namespaces --selector=tier=frontend -o wide
Dkubectl get pods -n dev --selector=tier=frontend
Step-by-Step Solution
Solution:
  1. Step 1: Use namespace flag correctly

    Use '-n dev' to specify the 'dev' namespace.
  2. Step 2: Filter pods by label with --selector

    Use '--selector=tier=frontend' to filter pods with that label.
  3. Step 3: Add '-o wide' to show node and IP details

    The '-o wide' option adds extra columns like node and IP.
  4. Final Answer:

    kubectl get pods -n dev --selector=tier=frontend -o wide -> Option B
  5. Quick Check:

    Namespace + selector + wide output = kubectl get pods -n dev --selector=tier=frontend -o wide [OK]
Quick Trick: Combine -n, --selector, and -o wide for filtered detailed list [OK]
Common Mistakes:
  • Using --label instead of --selector
  • Using --all-namespaces instead of specific namespace

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes