Multi Container Pod Best Practice

2/25/2019

I am asked to create a pod with 5 container, what is the best solution for this situation, should i create a pod with 5 Con or split it into multiple pods , any suggestion

-- hesaum saboury
kubernetes

3 Answers

2/25/2019

There could be different reasons of running multiple containers in single pod. When the containers have the exact same lifecycle, or when the containers must run on the same node. Another reason to combine containers into a single pod is for easy communication between containers in the pod. These containers can communicate through shared volumes and through inter-process communication (semaphores or shared memory). If you really need to run multiple containers in single pod, different patterns available like sidecar, adapter, ambassador.

-- Abhay
Source: StackOverflow

2/25/2019

It is not a good practice to run 5 containers in one pod. Your pod would become heavy and the applications within the pod would be tightly coupled.

It would be difficult to manage the pod life cycle. say, one container is crashed for which readiness probe is configured, then the pod is treated as unhealthy and the pod gets restarted even though other 4 containers are up and running. debugging the issues would be difficult. suggest you to go with multiple pods unless you have a valid reason and is not possible to split the containers

-- P Ekambaram
Source: StackOverflow

2/25/2019

By rule of thumb , multiple containers should reside in same pod only if they share the same lifecycle. For example , suppose you have an application and along with it another helper/bridge service which serves as a window to outside world , then it might make sense for these two containers to stay together in one pod. But , I am really not sure in which sort of usecase will be require 5 containers to be put together in one pod.

Please understand , this does not provide any sort of advantage from resource point of view whether you have 5 containers in 1 pod or 5 pods , the resource utilization like cpu and memory will be still cumulative numbers of all the containers together.

-- fatcook
Source: StackOverflow