Kubernetes Pods

MrDevSecOps
3 min readFeb 12, 2022

--

To better understand pods, let’s take the above example.

As we know, Kubernetes is a runtime environment for containers, but before Kubernetes, we have Virtualization and Docker.

When we wanted to deploy an application in virtualization technology, which will deploy the application on a Virtual machine, and in the case of docker, we have Container, where our actual application is running.

Similarly, Pods are the atomic unit on the Kubernetes platform where we deployed the application and run it.

What is a pod in Kubernetes?

  • Pods are the smallest deployable units in Kubernetes.
  • A pod is just a wrapper around the container.
  • A Pod is a group of one or more containers, with shared storage and network resources and a unique IP address.
  • It contains one or more application containers that are relatively tightly coupled and use the shared volume.
  • A pod contains just a single container in a more common use case.
  • A Pod is not a process, but an environment for the running container(s).

Multi Containers Pod

  • Let us take an example of the Kubernetes cluster, which consists of multiple worker nodes and we deploy our pods in the worker1 node.
  • Each time pod gets created, it will get a new IP address, which is unique for the entire port network.
  • In case of the pod dies for some reason, this will create a new pod with a similar configuration but with a new IP address on the same node or other healthy nodes.
  • Here the pod IP is 10.1.0.1, and contains one container that acts as a primary container and the other container that acts as a supporting, and this concept is called multi-container.
  • we can deploy multiple containers in a single pod and each container has the same network namespace.
  • Each container will have its own unique port number within that pod.
  • In this example, the main container has Port no 8080 and Another container, which is a supporting container, has 2786.
  • In case we want to access the primary container from inside the pod, then we need to use the Pod IP address and port of the main container.

Similarly, the supporting container can be accessed by Pod IP and port 2786.

In case of the primary container wants to communicate with the second container within the same pod then it uses the localhost and followed by the port numbers.

Also, check

Kubernetes Tutorials

--

--

MrDevSecOps

Integrating security into the software development lifecycle.