Kubernetes

How Do I Check My Pod Details in Kubernetes?

In Kubernetes, Pods are the simplest and most basic deployable entities. In your cluster, a Pod defines a specific occurrence. One or even more containers, such as Docker containers, are contained in Pods. When many containers are running in a Pod, they are handled as a single entity that shares the Pod’s resources. Several containers in a single Pod are considered an advanced use case. A cluster’s processes are represented by Pods. Kubernetes can inform on the status of each process operating in the cluster by restricting Pods to a single process. While Pods can hold several containers, the most typical configuration is one container per Pod. Containers that are tightly tied and need to share resources may be placed in the same Pod in some cases. As though they were operating on the very same machine, Pods can interact fast and effortlessly with one another. Inside the cluster, each Pod is specified with its IP address, enabling the application to be using ports without interference. Pods are projected to be transient, disposable objects. When a Pod is generated, it is allocated to a node to run on. The Pod object is removed until the process is stopped. The Pod is evicted due to a shortage of resources or the node crashes. The Pod stays on that node. It is important to check Pod details in Kubernetes from time to time. So, we are going to explain the method to check Pod details in Kubernetes.

Pre-requisites

To check Pod details in Kubernetes, make sure to install Ubuntu 20.04 system and configure it as per your requirement. Also, the installation of a Minikube cluster is essential to get started with the services of Kubernetes.

Method to Check Pod Details in Kubernetes

To check Pod details in Kubernetes, open the command line terminal by looking it into the applications or utilizing the “Ctrl+Alt+T” shortcut key. Once you launch it, follow the steps explained in this step-by-step guide:

Step 1: Start Minikube Cluster

To get started with the services of Kubernetes, you have to run the Minikube cluster in your Ubuntu 20.04 system. So, execute the specified command in the terminal of your system:

$ minikube start

It may take a few minutes to start the Minikube cluster. You can check out the version of Minikube installed in your system.

Step 2: Create Configuration File of Pod

Now, you have to create a Pod configuration file in any text editor and your desired directory of the system. You have to save the following script in the file with the YAML extension. We have named it “hello”, as seen in the attached script:

We have saved the configuration file as “pod.yaml”

Step 3: Create Pod Using Terminal

After the formation of the configuration file, you have to run the following specified command in the shell:

$ kubectl create –f pod.yaml

Check the Pod has been created efficiently.

Step 4: Check the Summary of the Created Pod

To check the summary of all available Pods, you have to run the listed command:

$ kubectl get pods

The summary contains the name, status, restarts, and age of the Pod.

Step 5: Check Detailed Report of a Specific Pod

To check the detailed report of the specific Pod, you have to run the cited command in the shell.

$ kubectl describe <Pod name>

You can see the detailed information in the terminal window. The status information is discussed underneath.

  • Pending: The Pod is awaiting scheduling on a node or the initialization of at minimum one of its containers.
  • Running: The relevant Pod is allocated to a node and contains one or more currently operating containers.
  • Succeeded: All the containers in the Pod terminated successfully.
  • Failed: An issue occurred from one or more of the Pod’s containers.
  • Unknown: When the Kubernetes API server is unable to connect with the Pod’s node, this error occurs.

Conclusion

The article explained the basic concept of Pods along with the way to create them. We have explained the method to check the details of Pods in the system. I hope you can effectively implement this article at your end

About the author

Kalsoom Bibi

Hello, I am a freelance writer and usually write for Linux and other technology related content