kubectl get pods lists pods in the current namespace. kubectl get pods -A (or --all-namespaces) lists across all. kubectl get pods -o wide adds node name and IP. The team that uses -o json or -o yaml has full machine-readable output for scripting. The team that uses -w (watch) sees real-time updates.
Table of contents
- The basic command
- All namespaces
- Wide output
- Filter by label
- Filter by namespace
- Watch for changes
- JSON output for scripting
- FAQ
The basic command
kubectl get pods
Output:
NAME READY STATUS RESTARTS AGE
myapp-7d4f5b6c8d-abcde 1/1 Running 0 5m
myapp-7d4f5b6c8d-fghij 1/1 Running 0 5m
redis-0 1/1 Running 0 10m
The team that uses this gets a quick status check.
All namespaces
kubectl get pods -A
kubectl get pods --all-namespaces
Shows pods across every namespace. The team that uses -A doesn’t need to switch contexts to check other namespaces.
Wide output
kubectl get pods -o wide
Adds Node, IP, and nominated node:
NAME READY STATUS RESTARTS AGE IP NODE
myapp-7d4f5b6c8d-abcde 1/1 Running 0 5m 10.244.1.5 worker-1
The team that uses -o wide finds which node a pod is on - useful for debugging node-specific issues.
Filter by label
kubectl get pods -l app=myapp
kubectl get pods -l tier=frontend
The team that uses label selectors finds specific app components. K8s services use labels too, so this matches how traffic is routed.
Filter by namespace
kubectl get pods -n kube-system
kubectl get pods -n monitoring
The team that uses -n checks specific namespaces without switching context (kubectl config set-context --current --namespace=monitoring).
Watch for changes
kubectl get pods -w
Refreshes every few seconds. The team that uses this watches a deployment rollout in real-time.
JSON output for scripting
kubectl get pods -o json | jq '.items[].metadata.name'
kubectl get pods -o jsonpath='{.items[*].status.podIP}'
The team that uses jsonpath or jq extracts specific fields for scripts.
FAQ
How do I see pods in a specific namespace?
kubectl get pods -n <namespace>. The team that uses -A to see all namespaces at once.
Why does my pod show ‘Pending’?
Usually no node can schedule it (resource requests too high, taints/tolerations mismatch, no available nodes). The team that runs kubectl describe pod sees the events explaining why.
How do I sort pods by age?
kubectl get pods --sort-by=.metadata.creationTimestamp. The team that uses --sort-by has many options (name, age, status, etc).
Can I see resource usage per pod?
Yes with kubectl top pods (requires metrics-server). The team that has metrics-server has CPU/memory per pod.
What’s the difference between ‘Pending’ and ‘ContainerCreating’?
Pending: pod scheduled to a node, waiting for image pull or volume. ContainerCreating: container image being pulled and started. The team that uses kubectl describe pod sees the specific event.
If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.
Useful related references: