What is a POD in Kubernetes

As we discussed before with Kubernetes, it is our ultimate aim is to deploy our application in the form of containers on a set of machines that are configured as worker nodes in a cluster.

However, kubernetes does not deploy containers directly on the worker nodes. The containers are encapsulated into a kubernetes object knows as POD.

A pod is a single instance of an application. A pod is a smallest object that you can create in kubernetes.

Here we see the simplest of simplest cases where you have a single node kubernetes and cluster with a single instance of your application running in a single docker container encapsulated in a pod.

What if the number of users accessing your application increases and you need to scale your application? You need to add additional instance of your web application to share the load. Where would you spin up an additional instances? Do we bring up new container instance withing the same POD?

No, we create new POD altogether with a new instance of the same application.

As you can see, we now have two instances of our web application running on two separate pods on the same node. What if the user base further increases and your current node has no sufficient capacity? Well, then you can always deploy additional pods on a new node.

In the cluster, you will have a new node added to the cluster to expand the cluster’s physical capacity.

POD usually have one to one relationship with container running your application. You create new pods to scale up and destroy pods to scale down. You do not add additional containers to the existing pod to scale your application.

I know now you are wondering how we implement all of these and how load balancing will happen between pods. We will discuss it in a later article.

We just discussed the pods usually have one to one relationship with containers. It is not restricted by Kubernetes, but that is standard practice.

A single pod can have multiple containers but they usually now multiple containers of same kind. I have described it in a different article.

How to create a pod?

You can use kubectl run command to create a pod

Above command will download nginx image from docker hub and create a pod name nginx-container.

Also you can specify pod definition in yaml file i.e pod definition file.

Then you can use kubectl apply command to run it.

Passionate Technical Lead, Senior Software Developer and free and open source software advocate

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store