Kubernetes Commands
devopskubernetesReferenceBeginner
kubectl get
List one or more Kubernetes resources such as Pods, Deployments, Services, Nodes, and Namespaces with custom output formatting.
Verified: 2026-10-01
Tested on:kubernetes 1.31
Platforms:
all
#kubernetes#kubectl#get#pods#resources
Command
kubectl get pods -n default -o wide
Short Description
kubectl get lists one or more API resources in your cluster, displaying tabular status columns like readiness, restart count, age, IP address, and hosting node.
Syntax
kubectl get <resource_type> [NAME] [FLAGS]Examples
1. List Pods Across All Namespaces
kubectl get pods -A2. Output Full Object Definition in YAML
kubectl get deployment api-server -o yaml3. List Services with Wide Details
kubectl get svc -o wide4. Filter Pods by Label Selector
kubectl get pods -l app=web,environment=productionCommon Options
| Option | Shorthand | Description |
|---|---|---|
--all-namespaces | -A | List requested resources across all cluster namespaces. |
--namespace | -n | Specify target namespace (defaults to active context). |
--output | -o | Output format: wide, yaml, json, name, jsonpath. |
--selector | -l | Filter resources by label key=value pairs. |
--watch | -w | Stream real-time resource state updates. |