kubectl get

List Kubernetes resources with flexible output options.

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

kubectl get is the primary read command for K8s. It lists resources with status. Output formats range from human-friendly tables to machine-parseable JSON/YAML. The -w flag watches for changes. Mastering -o and --field-selector transforms kubectl from a query tool into an automation backbone.

Common flags
FlagMeaning
-n --namespaceTarget namespace
-A --all-namespacesAll namespaces
-o --outputFormat: json, yaml, wide, jsonpath, custom-columns
-w --watchWatch for changes
--field-selectorFilter by field values
-l --selectorFilter by label
Examples
kubectl get pods -A -o wideAll pods across namespaces with node info · explain & risk-check →
kubectl get pods -l app=nginx -wWatch nginx pods for changes · explain & risk-check →
kubectl get pods -o jsonpath='{.items[*].metadata.name}'Extract pod names for scripting · explain & risk-check →
kubectl get nodes -o custom-columns=NODE:.metadata.name,STATUS:.status.conditions[-1].typeCustom columns output · explain & risk-check →
kubectl get events -A --sort-by='.lastTimestamp' | tail -20Recent cluster events · explain & risk-check →
Pro tip

Use `kubectl get pods -o json | jq -r '.items[] | select(.status.phase!="Running") | .metadata.name'` to programmatically find non-running pods — far more reliable than parsing tabular output.

Related
kubectl describe kubectl logs kubectl exec
Open the full explainer →More in Kubernetes & Helm

Reference text is hand-written and may be incomplete — check man kubectl for your version. Test destructive commands on a non-production system first.