<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=521127644762074&amp;ev=PageView&amp;noscript=1">

Tell us more


How to Create, View and Destroy a Pod in Kubernetes


In our How-to-Kube series, we’d like to begin by covering the pod basics. Like service, volume, and namespace, a pod is a basic Kubernetes object. A pod is the smallest execution unit, consisting of a single container or a series of related containers of an application. Along with the application’s container, a pod also contains storage resources and options for container processes.

In this post, you’ll learn how to create a pod in Kubernetes using the nginx image, view the YAML which describes the pod and then delete the pod that you’ve created. We’ll be using the Minikube tool that enables you to run a single-node Kubernetes cluster within the VM of your laptop or computer. Let’s get started.

How to Create a Pod in Kubernetes

To begin, you need to launch a Kubernetes cluster. Once you’re in the Kubernetes sandbox environment, which can be created in the Katacoda docker, make sure you’re connected to the Kubernetes cluster by executing code kubectl get nodes in the command line and seeing the cluster appear in the terminal. Then, you’re ready to create and run a pod.

Use the command line to create a pod using the nginx image, starting with kubectl and running command nginx which for this exercise will become the name of the kube. Now you need to specify the image where you’re going to get the container with ---image=nginx.

Finally, make sure to fill the --restart flag with =Never, or you’re risking creating a deployment instead of a pod. Once you hit enter, the pod will be created. You should see pod/nginx created appear in the terminal.

Deploy command get po to get the pod ready and running.

How to View a Pod

Viewing the configuration of the pod only takes one step. Just run kubectl describe po nginx in your terminal.

The terminal will now display the YAML for the pod, starting with the name nginx, its location, the Minikube node, start time and current status. You will also see in-depth information about the nginx container, including the container ID and where the image lives.

If you scroll all the way to the bottom of the terminal, you’ll see the events that have occurred in the pod. In the case of this tutorial, you’ll see that the pod was started, created, the nginx image was pulled successfully and been assigned to this pod in Minikube.

New call-to-action

Destroy Pod

The action of deleting the pod is simple. To delete the pod you have created, you once again begin the action with kubectl, followed by command delete pod nginx.Confirm the name of the pod you want to delete before pressing Enter. If you have completed the task of deleting the pod successfully, pod nginx deleted will appear in the terminal.


Pods are a vital unit for understanding the Kubernetes object model, as they represent the processes within an application. In most cases pods serve as an indirect way to manage containers within the Kubernetes. In more complex use cases, pods may encompass multiple containers that need to share resources, serving as the central location for container management.

No matter how you use them, pods will always be at the foundation of Kubernetes. To learn how to use services to expose pods and help applications communicate within Kubernetes, check out our next post in the series, How-To-Kube: Services.

download-kubernetes-best practices-1