In this article let us explore the reasons why we need POD in Kubernetes and why cannot we deploy the container directly to Kubernetes.
Before we start with our reasoning, Let us refresh our memory with what is POD
POD ( as in a pod of whales or a pod of peas) generally means co-located items into a small group.
In the pod of peas analogy, you can replace peas with containers when you think of Kubernetes PODS.
POD is a Basic building element of Kubernetes which you can relate to the POD of peas or the POD of whales.
Why do we need a pod in Kubernetes?
To understand why we need pods, we need to refresh the basics of Containers or containerization
Containerization is an application-level or os-level virtualization where the centre element is an application surrounded by necessary resources and libraries.
Containers are designed to run a single process or application unless the application itself spawns child processes.
If you try to run multiple processes in a single container, It would raise the following concerns
Let's suppose you try to place
nginx (reverse proxy) and
nodejs ( app server) in the same container
- How would we manage the Process uptime of all the processes? We need to write our own uptime monitoring script
- How would we manage the logs of each process since the stdout channel is common for both processes? how would we identify the logs are coming from which process (nginx or nodejs)
- If the container crash, It would be our responsibility to make sure all the processes are coming back online.
The whole self recovering and reliability of Kubernetes would be voided. is not it?
For these very reasons, we cannot combine multiple processes together in a container
Since we cannot combine the processes, we need to create them as different containers,
But, when we have containers that should co-exist like in our case nginx and nodejs,
We need some kind of a wrapper to combine the containers and that is where POD comes
There are multiple ways to combine or group the containers together such as
The Sidecar is the most prominent of them all. We will cover these patterns and their differences in the next article
Signup for Exclusive "Subscriber-only" Content