• Modern UX

    Edit and navigate faster in the terminal with Warp's IDE-like input editor.

  • Warp AI

    AI suggests what commands to run and learns from your documentation.

  • Agent Mode

    Delegate tasks to AI and use natural language on the command line.

  • Warp Drive

    Save and share interactive notebooks, workflows, and environment variables.

  • All Features

Describe Kubernetes Pods With kubectl

Thumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi Manhas
Mansi Manhas

Mansi Manhas

Published: 1/31/2024

About Terminus

In Kubernetes, Pods create a shared environment for one or more containerized application. This shared environment allows containers to communicate and share common resources easily.

The short answer

To display the detailed information of a single Pod, you can use the kubectl describe pod  command followed by the name of the Pod:

$ kubectl describe pod <pod_name>

Run in Warp

For example: 

$ kubectl describe pod my-pod

Run in Warp

Upon execution, the above command will output verbose details about the Pod, such as its status, IP address, associated namespace, ports, events, the status of the containers running within it, and more. These comprehensive details are helpful when debugging or troubleshooting any potential issues with your running Pod.

You can learn more about troubleshooting Pods in Kubernetes by reading our article on how to get the logs of Pods using the kubectl command.

Easily retrieve this command using Warp’s AI Command Suggestions

If you’re using Warp as your terminal, you can easily retrieve this command using the Warp AI Command Suggestions feature:

Thumbnail for Thumbnail for Thumbnail for Thumbnail for

Entering k8 describe pod  in the AI Command Suggestions will prompt a kubectl  command, which can be inserted quickly into your shell by doing CMD+ENTER.

Describing Pods in a namespace

To describe a pod in a specified namespace, you can use the kubectl describe pod  command with the -n  flag (short for  --namespace ):

$ kubectl describe pod <pod_name> -n <namespace>

Run in Warp

For example:

$ kubectl describe pod my-pod -n my-namespace

Run in Warp

Note that, if you attempt to describe a Pod that does not exist in the specified namespace, the command will result in an error, indicating that the Pod does not exist.

Describing all Pods at once

To describe all the pods in your cluster at once, you can use the following command:

$ kubectl describe pods

Run in Warp

Upon execution, the above command will provide details for every pod within your cluster. This will help you see the status of all pods at once, making it easier to check their overall health instead of going through them individually.

Understanding the output of the kubectl describe pod command

While the kubectl describe pod  command displays extensive information about Pods, its output can be quite overwhelming to navigate.

Thumbnail for Thumbnail for Thumbnail for Thumbnail for

Here’s a breakdown of the essential information provided by this command.

Main Pod information

The first section contains general information about the Pod itself.

Thumbnail for Thumbnail for Thumbnail for Thumbnail for

Where:

  • Name is the unique name of the Pod.
  • Namespace is the namespace the Podis associated with.
  • Priority specifies the preference for pod execution by the Kubernetes scheduler.
  • Service Account is the pod identity used for accessing cluster resources.
  • Node represents a virtual or physical machine where the Pod is executed.
  • Start Time is the timestamp of the Pod creation.
  • Labels are user-defined key-value pairs used to identify the Pod.
  • Annotations are additional metadata for the Pod.
  • Status is the current execution status of the Pod.
  • IP is the IP address of the Pod.

Understanding the Pod status

The Pod Status  property gives an immediate overview of the Pod’s current health.

It takes 5 possible values:

  • Pending : the Pod is created, but its containers are not yet ready to run.
  • Running : the Pod is actively running on the node, with at least one container in a running state.
  • Succeeded : all containers in the Pod have terminated successfully (with an exit status of 0 ).
  • Failed : one or more containers within your Pod have terminated with a non-zero exit status, signifying an error.
  • Unknown : the state of the Pod cannot be determined, and is typically temporary due to node failures or network issues.

Note that, if a Pod gets stuck in a status different from Running for a long period of time, this might indicate that there is a potential issue with the functioning of the Pod.

Also note that, if the Pod gets stuck in the Pending state, it cannot be scheduled on a node due to insufficient resources. You can use the official guide for debugging pods and debugging running pods to identify the bottleneck issues of your Pod.

The Containers section

The Containers section provides detailed information about the containers running within the Pod, such as their current status and configuration.

Thumbnail for Thumbnail for Thumbnail for Thumbnail for

Containers running within Pods can be in three different states:

  • Waiting : the container is not yet running due to some initial setup or readiness checks.
  • Running : the container is actively running.
  • Terminated : the container has finished executing and has exited, either successfully or due to a failure that caused its termination.

The Conditions section

The Conditions section provides information about a list of conditions a Pod has passed (or not), each of which describes a specific aspect of the Pod's state.

Thumbnail for Thumbnail for Thumbnail for Thumbnail for

Some of the most common conditions are:

  • Initialized which indicates whether all init containers have completed successfully.
  • Ready which indicates whether the Pod is fully operational and is able to serve requests.
  • ContainersReady which indicates whether all containers in the Pod are ready and able to accept traffic.
  • PodScheduled which indicates whether the Pod has been scheduled to run on a node.

You can learn more about conditions on the official documentation page.

The Events section

The Events section provides a chronological log of events and activities related to your Pod. Common types of events include pod scheduling, container start, image pulling, and so on.

Thumbnail for Thumbnail for Thumbnail for Thumbnail for

Each log usually contains 5 properties:

  • Type: the type of event like Normal , Warning , or Error .
  • Reason: a brief code describing the event (e.g. Pulling, Created).
  • Age: the time when the event occurred.
  • From: the component responsible for logging the event.
  • Message: the detailed description of the event.

These events will help identify failures in your running Pod. For example, if a container within a Pod cannot start, the Reason  will be set to ContainerCannotRun  and accompanied by the additional context in the Message  property.

Describing a Pod using a configuration file

To describe a Pod using a YAML or JSON file containing the pod’s configuration, you can use the kubectl describe pod command with the -f flag:

$ kubectl describe -f <path>

Run in Warp

Where:

  • path  is the relative or absolute path of the Pod's configuration file.

For example:

$ kubectl describe -f ./myPodConfiguration.yaml

Run in Warp

This command will display all the details of your Pod, such as its status, the status of containers running within it, IP address, associated namespace, ports, events, and more (similar to the kubectl describe pod  command).

Describing a Pod using YAML and JSON

By default, the kubectl describe pod command doesn’t provide an option to output the information in YAML or JSON format.

To do so, you can use the kubectl get pods command instead with the -o  flag, followed by the name of the desired format:

$ kubectl get pods <pod_name> -o <format>

Run in Warp

Where:

  • format is either yaml or json .

For example: 

$ kubectl get pod my-pod -o yaml

Run in Warp

The above command displays the pod information in YAML format, including details about the Pod, its containers, status, and more.

Written by

Thumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi Manhas
Mansi Manhas

Mansi Manhas

Filed Under

Related Articles

Copy Files From Pod in Kubernetes

Learn how to copy files and directories from within a Kubernetes Pod into the local filesystem using the kubectl command.

Kubernetes
Thumbnail for Razvan LudosanuThumbnail for Razvan LudosanuThumbnail for Razvan LudosanuThumbnail for Razvan Ludosanu
Razvan Ludosanu

Scale Deployments in Kubernetes

Learn how to manually and automatically scale a Deployment based on CPU usage in Kubernetes using the kubectl-scale and kubectl-autoscale commands.

Kubernetes
Thumbnail for Razvan LudosanuThumbnail for Razvan LudosanuThumbnail for Razvan LudosanuThumbnail for Razvan Ludosanu
Razvan Ludosanu

Get Kubernetes Logs With kubectl

Learn how to get the logs of pods, containers, deployments, and services in Kubernetes using the kubectl command. Troubleshoot a cluster stuck in CrashloopBackoff, ImagePullBackoff, or Pending error states.

Kubernetes
Thumbnail for Ekene EjikeThumbnail for Ekene EjikeThumbnail for Ekene EjikeThumbnail for Ekene Ejike
Ekene Ejike

Forward Ports In Kubernetes

Learn how to forward the ports of Kubernetes resources such as Pods and Services using the kubectl port-forward command.

Kubernetes

Tail Logs In Kubernetes

Learn how to tail and monitor Kubernetes logs efficiently to debug, trace, and troubleshoot errors more easily using the kubectl command.

Kubernetes

Get Context In Kubernetes

Learn how to get information about one or more contexts in Kubernetes using the kubectl command.

Kubernetes

Delete Kubernetes Namespaces With kubectl

Learn how to delete one or more namespaces and their related resources in a Kubernetes cluster using the kubectl command.

Kubernetes

Get Kubernetes Secrets With kubectl

Learn how to list, describe, customize, sort and filter secrets in a Kubernetes cluster by name, type, namespace, label and more using the kubectl command.

Kubernetes
Thumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi Manhas
Mansi Manhas

List Kubernetes Namespaces With kubectl

Learn how to list, describe, customize, sort and filter namespaces in a Kubernetes cluster by name, label, and more using the kubectl command.

Kubernetes
Thumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi Manhas
Mansi Manhas

How To List Events With kubectl

Learn how to list and filter events in Kubernetes cluster by namespace, pod name and more using the kubectl command.

Kubernetes
Thumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi Manhas
Mansi Manhas

Kubernetes vs Docker: The Backbone of Modern Backend Technologies

Lean the fundamentals of the Kubernetes and Docker technologies and how they interplay with each other.

KubernetesDocker
Thumbnail for Gabriel ManricksThumbnail for Gabriel ManricksThumbnail for Gabriel ManricksThumbnail for Gabriel Manricks
Gabriel Manricks

Set Context With kubectl

Learn how to create, modify, switch, and delete a context in Kubernetes using the kubectl config command.

Kubernetes
Thumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi ManhasThumbnail for Mansi Manhas
Mansi Manhas

Trusted by hundreds of thousands of professional developers

Download Warp to get started

Download for Mac
Request demo
Thumbnail for nullThumbnail for nullThumbnail for nullThumbnail for null