LinuxCommandLibrary

kubectl-describe

Show detailed information about Kubernetes resources

TLDR

Show details of pods in a namespace

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

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

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

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

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

SYNOPSIS

kubectl describe TYPE NAME_PREFIX

PARAMETERS

TYPE
    The type of Kubernetes resource to describe (e.g., pod, service, deployment, node). Can be a singular or plural name.

NAME_PREFIX
    The name or prefix of the resource(s) to describe. If a prefix is given, all resources matching that prefix will be described.

--all-namespaces
    If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified on commandline.

-l, --selector string
    Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)

-n, --namespace string
    If present, the namespace scope for this CLI request.

--api-version string
    The specific API version to use. (e.g. extensions/v1beta1)

--chunk-size int
    Return large lists in chunks rather than single block. Pass 0 to disable. Valid only for cached lists and watch.

--filename string
    Filename, directory, or URL to resources to use to augment the describe.

-f, --filename stringArray
    Filename, directory, or URL to resources to use to augment the describe. Use -f=- to read from stdin.

--kustomize string
    Process the kustomization directory. Useful if you want to describe a kustomization target.

-o, --output string
    Output format. One of: json|yaml|wide|name|custom-columns|custom-columns-file|go-template|go-template-file|jsonpath|jsonpath-as-json|jsonpath-file.

--recursive
    Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.

--short
    If true, print only the NAME of the resource being described, or the error if it occurs. If false, use the normal describe output.

DESCRIPTION

The `kubectl describe` command provides detailed information about Kubernetes resources, making it an invaluable tool for debugging, monitoring, and understanding the state of your cluster. It retrieves various aspects of a resource, including its configuration, status, events, and related objects. This enables you to gain a comprehensive view of the resource's health, dependencies, and any issues it might be experiencing. You can use it to inspect Pods, Services, Deployments, ReplicaSets, Nodes, and almost all other Kubernetes resource types. kubectl describe pulls information from the Kubernetes API server and presents it in a human-readable format, including labels, annotations, and specific field values. The generated output is extremely helpful to understand and troubleshoot problems such as failed pod creation, connection failures to services, container restarts, resource limits, and resource allocation.

CAVEATS

The output can be verbose, especially for complex resources. Filtering by name prefix can be useful when dealing with large numbers of resources. Ensure you have the correct permissions (RBAC rules) to access the resources you are trying to describe.

EXAMPLE USAGE

Describe a pod named 'my-pod':
`kubectl describe pod my-pod`

Describe all pods:
`kubectl describe pods`

Describe a service named 'my-service' in the 'dev' namespace:
`kubectl describe service my-service -n dev`

Describe a node named 'node01':
`kubectl describe node node01`

Describe pods with label app=myapp:
`kubectl describe pods -l app=myapp`

SEE ALSO

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

Copied to clipboard