LinuxCommandLibrary

kubectl-describe

Show detailed information about Kubernetes resources

TLDR

Show details of pods in a namespace

$ kubectl describe [[po|pods]] [[-n|--namespace]] [namespace]
copy

Show details of nodes in a namespace
$ kubectl describe [[no|nodes]] [[-n|--namespace]] [namespace]
copy

Show the details of a specific pod in a namespace
$ kubectl describe [[po|pods]] [pod_name] [[-n|--namespace]] [namespace]
copy

Show the details of a specific node in a namespace
$ kubectl describe [[no|nodes]] [node_name] [[-n|--namespace]] [namespace]
copy

Show details of Kubernetes objects defined in a YAML manifest file
$ kubectl describe [[-f|--filename]] [path/to/manifest.yaml]
copy

SYNOPSIS

kubectl describe (-f FILENAME | TYPE [NAME_PREFIX]) [flags]

PARAMETERS

-f, --filename []string
    Filename, directory, or URL to files identifying the resource to describe

-l, --selector string
    Selector (label query) to filter on, supports '=', '==', '!=', NOT IN (negation)

-R, --recursive bool
    Process the directory used in -f, --filename recursively

--raw string
    Display the raw JSON/YAML output for the given resource name

-n, --namespace string
    Namespace scope for this request

-o, --output string
    Output format (overrides describe format if not raw)

--context string
    Kubeconfig context to use

-v, --v=0
    Log level for more verbose output

--kubeconfig string
    Path to kubeconfig file

--field-selector string
    Selector to filter fields

DESCRIPTION

kubectl describe is a Kubernetes CLI command that provides a comprehensive, human-readable summary of a resource's current state, configuration, and recent events. It fetches data from the API server and formats it into sections like Namespace, Labels, Annotations, Status, Conditions, and Events. This is invaluable for troubleshooting issues such as pod crashes, service misconfigurations, or deployment rollouts.

For pods, it shows container statuses, restarts, logs excerpts, and node assignments. For nodes, it details capacity, allocatable resources, and conditions like memory pressure. Supports multiple resources via selectors or files.

Run as kubectl describe pod <name> or with -l app=myapp for filtered views. Output is verbose by design, aiding diagnostics without needing raw YAML. Recent events (typically last 60 minutes) are listed chronologically, with warnings for failures. Combine with kubectl get for lists or kubectl logs for deeper inspection.

CAVEATS

Events are limited to recent ones (usually last hour); use kubectl get events for full history. Output can be voluminous for complex resources.

EXAMPLES

kubectl describe pod mypod
kubectl describe pods -l app=nginx -n default
kubectl describe -f deployment.yaml

OUTPUT SECTIONS

Common: Name, Status, Events (warnings first), Conditions with reasons.

HISTORY

Part of kubectl since Kubernetes v1.0 (2014); evolved with resource types and selectors in subsequent releases for better diagnostics.

SEE ALSO

kubectl get(1), kubectl logs(1), kubectl explain(1), kubectl events(1)

Copied to clipboard