Bird
0
0

Which kubectl command lists all pods in all namespaces along with the nodes they are running on?

hard📝 Workflow Q9 of 15
Kubernetes - kubectl Essential Commands
Which kubectl command lists all pods in all namespaces along with the nodes they are running on?
Akubectl get pods --all-namespaces -o wide
Bkubectl describe pods --all-namespaces
Ckubectl get pods -n kube-system -o jsonpath='{.items[*].spec.nodeName}'
Dkubectl get pods -o name
Step-by-Step Solution
Solution:
  1. Step 1: Identify command to list pods across namespaces

    The flag --all-namespaces lists pods in all namespaces.
  2. Step 2: Include node information

    The -o wide option adds node names and other details.
  3. Step 3: Evaluate options

    kubectl get pods --all-namespaces -o wide correctly combines both flags. kubectl describe pods --all-namespaces shows detailed info but not in a concise list. kubectl get pods -n kube-system -o jsonpath='{.items[*].spec.nodeName}' filters only kube-system namespace and uses jsonpath incorrectly. kubectl get pods -o name lists pod names only without node info.
  4. Final Answer:

    kubectl get pods --all-namespaces -o wide -> Option A
  5. Quick Check:

    Does the command show pods from all namespaces with node names? [OK]
Quick Trick: Use --all-namespaces and -o wide to see nodes [OK]
Common Mistakes:
  • Omitting --all-namespaces flag
  • Using describe instead of get for concise list
  • Incorrect jsonpath usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes