Why POD is the fundamental unit of deployment instead of containers?

4/6/2019

In Kubernetes POD is considered as a single unit of deployment which might have one or more containers, so if we scale all the containers in the POD are scaled irrespectively.

If the POD has only one container its easier to scale the particular POD, so whats purpose of packaging one or more containers inside the POD?

-- tamil
docker
kubernetes

2 Answers

4/6/2019

From the documentation:

Pods can be used to host vertically integrated application stacks (e.g. LAMP), but their primary motivation is to support co-located, co-managed helper programs

The most common example of this is sidecar containers which contain helper applications like log shipping utilities.

A deeper dive can be found here

-- DWSR
Source: StackOverflow

4/6/2019

The reason behind using pod rather than directly container is that kubernetes requires more information to orchestrate the containers like restart policy, liveness probe, readiness probe. A liveness probe defines that container inside the pods is alive or not, restart policy defines the what to do with container when it failed. A readiness probe defines that container is ready to start serving.

So, Instead of adding those properties to the existing container, kubernetes had decided to write the wrapper on containers with all the necessary additional information.

Also, Kubernetes supports the multi-container pod which is mainly requires for the sidecar containers mainly log or data collector or proxies for the main container. Another advantage of multi-container pod is they can have very tightly coupled application container together sharing the same data, same network namespace and same IPC namespace which would not be possible if they choose for directly using container without any wrapper around it.

Following is very nice article to give you brief idea:

https://www.mirantis.com/blog/multi-container-pods-and-container-communication-in-kubernetes/

-- Prafull Ladha
Source: StackOverflow