inspection
kubectl describe
Shows a human-readable, aggregated view of a resource including its spec, status, related events, and controllers. It is the go-to command for debugging why a pod is Pending, CrashLoopBackOff, or otherwise misbehaving.
kubectl describe TYPE[/NAME | NAME] [flags] Common flags
| Flag | Purpose |
|---|---|
| -n, --namespace | Namespace of the resource. |
| -l, --selector | Describe all resources matching a label selector. |
| -A, --all-namespaces | Describe matching resources across all namespaces. |
| --show-events | Include events section (default true; use =false to hide). |
| -f, --filename | Describe the resources referenced in a file, directory, or URL. |
Examples
kubectl describe pod web-abc123 See containers, volumes, conditions, and recent events for a pod.
kubectl describe node worker-1 Inspect node capacity, allocatable, taints, and running pods.
kubectl describe deploy api -n prod Roll-history summary and ReplicaSet status for the api Deployment.
Gotcha
Output is not machine-parseable; use kubectl get -o yaml/json for scripting. Events roll off after ~1 hour by default.
Related commands
kubectl get
Lists one or more resources of a given type from the cluster. It is the primary read command for pods, services, deployments, and any other Kubernetes object, with flexible output formats for scripting and inspection.
kubectl logs
Prints container logs from a pod, deployment, or other workload. Supports streaming, previous-instance recovery after crashes, and selecting a specific container in multi-container pods.
kubectl explain
Prints documentation for a resource kind and its fields, sourced from the live cluster's OpenAPI schema. It is the offline-safe reference for authoring manifests against the exact API version your cluster serves.
kubectl cluster-info
Prints the endpoints of the control-plane services for the current context. The dump subcommand collects a large diagnostic bundle of cluster state for offline analysis.
kubectl top
Displays CPU and memory usage for nodes or pods, powered by the metrics.k8s.io API. Requires the metrics-server (or an equivalent aggregator) to be installed in the cluster.