Are you new to Kubernetes and baffling around Pods? Then you’re at the right place, I will help you to understand everything required to get start with Kubernetes Pod.
In this post we will be seeing below topics,
- What is Kubernetes or K8s Pods?
- What is Multi Container Pod?
- Inter and Intra Pod Communication?
So let’s get started!!!!!!
What is K8s Pods?
Pods are the atomic unit of K8s. Pod’s are like isolated virtual machines which runs containers inside it.
As per official definition: Pods are the smallest, most basic deployable objects in Kubernetes.
A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers.
A node can run one or mode Pods and every pod gets and different IP called as POD IP.
A pod represents an application/microservice running inside K8s cluster.
What is Multi Container Pod?
Generally, we run single container inside a Pod but sometimes we might end up doing advanced deployment where we have to deploy supporting containers or side car containers to support our main car container. Our supporting containers can be logging container or queue container or any sort of helping process which is required by our main container.
Note: Every container inside a pod shares same volume and ip as they have common namespace.
In the above figure Pod3 and Pod4 are multi container pods where as Pod1 and Pod2 are single container pod.
Inter and Intra Pod Communication?
How do Pod communicate with each other? How does containers inside a pod communicate with each other? Let us try to understand that….
We know that every pod inside a container gets an IP called as POD IP, and every container inside a common Pod shares the same IP.
In the figure above we have two containers running inside same Pod whose IP address is 10.0.50.10. This Pod is running two containers at 8080 and 8081 respective ports. Here both the containers will interact using localhost and port name.
In the above figure we see two Pods with 10.0.50.10 and 10.0.50.20 IP’s respectively. Here the communication between the different Pod happens over Pod IP followed by port.
So container communications inside a Pod happens over localhost and two Pods communicate over Pod IP.
I hope this was helpful to understand or get started with Pods in K8s.
In the next post we will be seeing how to launch Pod using manfiest files.
2 thoughts on “Introduction to Kubernetes Pods”