kubectl get pods lists pods in the current namespace. kubectl get pods -A lists all of them across every namespace. kubectl get pods -n kube-system lists one namespace. kubectl get pods -l app=nginx filters by label. kubectl get pods -o wide adds node and IP. The team that runs a cluster daily has the -A and -o wide flags memorized.
Table of contents
- The basic command
- All namespaces
- One namespace
- Filter by label
- Output formats and the -o flag
- The watch flag
- How this fits the rest of the stack
- FAQ
The basic command
kubectl get pods
Output: a table with NAME, READY, STATUS, RESTARTS, AGE. The current namespace is in the kubeconfig (set by kubectl config set-context --current --namespace=<ns> or --namespace flag).
The team that does not know the current namespace runs kubectl config view --minify | grep namespace. The team that wants to skip the namespace question entirely uses -A.
All namespaces
kubectl get pods -A
Output: same table with a NAMESPACE column prepended. This is the right starting point when triaging - the team that debugs a missing service runs this first to see if the pods are in an unexpected namespace.
Short form: kubectl get pods --all-namespaces. -A is the standard shorthand.
One namespace
kubectl get pods -n kube-system
kubectl get pods --namespace kube-system
Same output, just for that namespace. The team that scripts a kubectl get pods -n loop reads the namespace from the script, not the kubeconfig.
Filter by label
kubectl get pods -l app=nginx
kubectl get pods -l app=nginx,tier=frontend
kubectl get pods -l 'app in (nginx, redis)'
kubectl get pods -l app!=nginx
Label selectors are the standard way to filter. The team that deploys via Helm has labels like app.kubernetes.io/name and app.kubernetes.io/instance automatically - filter on those.
Output formats and the -o flag
-o wide adds NODE, IP, and NOMINATED NODE columns:
kubectl get pods -A -o wide
The team that needs to find which node a pod is on uses -o wide.
-o json or -o yaml for the full object:
kubectl get pod my-pod -n my-ns -o json
Useful for piping to jq or extracting specific fields. The team that scripts a deploy health check uses kubectl get pod -o jsonpath='{.status.phase}' to get just the phase.
The watch flag
kubectl get pods -w
Streams updates as pods change state. The team that waits for a deploy to roll out uses -w to see the new pod come up and the old one terminate.
FAQ
What is the difference between kubectl get pods and kubectl get po?
Nothing. po is the short form. The team that scripts kubectl uses the short forms (po, svc, deploy, ns) for readability.
Why is my pod stuck in Pending?
Pending means the scheduler has not placed it on a node yet. Common causes: insufficient CPU/memory on any node, the node selector does not match any node, the persistent volume claim is not bound, the image pull is failing. The team that sees Pending runs kubectl describe pod <name> to read the events.
What is CrashLoopBackOff?
The pod started, crashed, restarted, crashed again. Common causes: a bug in the application, a missing env var, a misconfigured command, a failed healthcheck. The team that sees CrashLoopBackOff runs kubectl logs <pod> --previous to read the previous container’s logs.
How do I get the full state of a pod?
kubectl get pod <name> -n <ns> -o yaml. Or kubectl describe pod <name> -n <ns> for the human-readable summary with events.
Can I list pods by node?
kubectl get pods -A --field-selector=spec.nodeName=<node-name>. Or kubectl describe node <name> to see all pods on a node.
How this fits the rest of the stack
For a sense of what the full project costs before it commits, the RunxBuild hosting calculator shows the line items together. The API, the database, the storage, the worker, the bandwidth - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers.
Useful related references: