Multi Container POD in Kubernetes

Vinay Singh
3 min readMar 26, 2023

--

In Kubernetes, a pod is the smallest deployable unit that can be managed. It represents a single instance of a running process in a cluster. A multi-container pod is a pod that contains more than one container that are tightly coupled and share the same resources such as network and storage volumes.

In multi container pods the container communicate each other over same network
let us create a problem if an application needs several containers running on the same host, why not just make a single container with everything you need? The Answer is if a single container contain the multiple process it share the same library and in containerization we are follow the single process in single container

Generally in a single pod minimum have 2 container
1: main container
2: pause container

Maximum container we can create no more then 300,000

Use Case of Multi Conatainer

1: Sidecar Containers:

— — The concept is very clear to the name ,it help to main container for sharing a data or content some other example is log or data change ,monitoring etc

In this example: it create two container ,first create a volume name html and its mount to the first Nginx container and also mount to debain container for sharing the data to created by second container name conatiner-2nd and give the volume name html and then give to Nginx container

2: Proxies, bridges, and adapter:

It Help to main container to re-route the request and also behave as proxy container of the main container

Inter-process communications (IPC)

Containers in a Pod share the same IPC namespace, which means they can also communicate with each other using standard inter-process communications such as SystemV semaphores or POSIX shared memory

kubectl apply -f filename and show the log of container
kubectl logs podname -c producer & kubectl logs podname -c consumer

By creating pods, Kubernetes provides a great deal of flexibility for orchestrating how containers behave, and how they communicate with each other. They can share file volumes, they can communicate over the network, and they can even communicate using IPC

--

--