liveBook · Manning

Kubectl describe

As explained in Kubernetes in Action, Second Edition

kubectl describe is a kubectl command that displays detailed information about a Kubernetes object and related cluster information.

kubectl describe displays detailed information about a Kubernetes object, expanding the summary returned by kubectl get into readable fields and operational context. section 3.2.3 section 4.2.4

Use it to inspect nodes, pods, services, and other resources when a short status line does not explain what is happening. section 3.2.3 section 5.2.3

A describe result can combine object data with useful related information:

  • Node details include its name, addresses, conditions, capacity, running pods, allocated resources, and related events. section 4.2.4
  • Pod details show information comparable to the complete YAML manifest, followed by chronological events such as scheduling, image pulling, container creation, and startup. section 5.2.3
  • Annotations appear in describe output, although kubectl's internal last-applied-configuration annotation is omitted there. section 7.5.3
  • Omitting the resource name prints information for all objects of the requested type, which is convenient when only one exists. section 3.2.3

Inspecting a pod

Run `kubectl describe pod kiada`. Read the object fields first, then inspect the events at the bottom. A normal sequence assigns the pod to a worker node, pulls its image, creates the container, and starts it; warning events indicate that further troubleshooting may be needed. section 5.2.3

$ kubectl describe node kind-worker-2
Name:               kind-worker2
Roles:              <none>
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=kind-worker2
                    kubernetes.io/os=linux
Annotations:        kubeadm.alpha.kubernetes.io/cri-socket: /run/contain...
                    node.alpha.kubernetes.io/ttl: 0
                    volumes.kubernetes.io/controller-managed-attach-deta...
CreationTimestamp:  Sun, 03 May 2020 17:09:48 +0200
Taints:             <none>
Unschedulable:      false
Lease:
  HolderIdentity:  kind-worker2
  AcquireTime:     <unset>
  RenewTime:       Sun, 17 May 2020 16:15:03 +0200
Conditions:
  Type             Status  ...  Reason                       Message
  ----             ------  ---  ------                       -------
  MemoryPressure   False   ...  KubeletHasSufficientMemory   ...
  DiskPressure     False   ...  KubeletHasNoDiskPressure     ...
  PIDPressure      False   ...  KubeletHasSufficientPID      ...
  Ready            True    ...  KubeletReady                 ...
Addresses:
  InternalIP:  172.18.0.4
  Hostname:    kind-worker2
Capacity:
  cpu:                8
  ephemeral-storage:  401520944Ki
  hugepages-1Gi:      0
  hugepages-2Mi:      0
  memory:             32720824Ki
  pods:               110
Allocatable:
  ...
System Info:
  ...
PodCIDR:                      10.244.1.0/24
PodCIDRs:                     10.244.1.0/24
Non-terminated Pods:          (2 in total)
  Namespace     Name               CPU Requests  CPU Limits  ...  AGE
  ---------     ----               ------------  ----------  ...  ---
  kube-system   kindnet-4xmjh      100m (1%)     100m (1%)   ...  13d
  kube-system   kube-proxy-dgkfm   0 (0%)        0 (0%)      ...  13d
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests   Limits
  --------           --------   ------
  cpu                100m (1%)  100m (1%)
  memory             50Mi (0%)  50Mi (0%)
  ephemeral-storage  0 (0%)     0 (0%)
  hugepages-1Gi      0 (0%)     0 (0%)
  hugepages-2Mi      0 (0%)     0 (0%)
Events:
  Type    Reason                   Age    From                      Message
  ----    ------                   ----   ----                      -------
  Normal  Starting                 3m50s  kubelet, kind-worker2     ...
  Normal  NodeAllocatableEnforced  3m50s  kubelet, kind-worker2     ...
  Normal  NodeHasSufficientMemory  3m50s  kubelet, kind-worker2     ...
  Normal  NodeHasNoDiskPressure    3m50s  kubelet, kind-worker2     ...
  Normal  NodeHasSufficientPID     3m50s  kubelet, kind-worker2     ...
  Normal  Starting                 3m49s  kube-proxy, kind-worker2  ...

A sample node description shows the readable layout of identity, labels, annotations, scheduling state, lease data, and conditions. section 4.2.4

How Kubernetes in Action, Second Edition covers it

How deep it goes
Shows readable object fields, related pods, allocated resources, annotations, and recent events, but omits complete command output.
Examples
Demonstrates node, pod, service, and annotated-pod inspections, including scheduling, image-pull, creation, and startup events.
What it assumes
Assumes basic kubectl use and Kubernetes resource names, then distinguishes summary output from detailed object and event information.
What you can do after
Diagnose/debug with it by reading resource state, related objects, annotations, and recent lifecycle events.
How it connects
Connects Kubernetes API objects with nodes, pods, services, YAML manifests, events, annotations, and kubectl get.

Also explained in

Compare how 2 books explain kubectl describe →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.