Rakesh Gupta
Rakesh Gupta

Reputation: 3780

Whats the max number of containers that can be run in a Pod?

I understand that a pod can have multiple containers. But, I am trying to find if there is a max limit on the number of containers within a pod. I have googled around, but could not find an answer.

Upvotes: 5

Views: 18323

Answers (3)

Rakesh Gupta
Rakesh Gupta

Reputation: 3780

No limit - as long as the node can satisfy the resource requirements

After further research I have discovered the following:

Cgroup In Brief

Cgroups, short for Control Groups, is provided by the Linux kernel. It is applied to restrict, record, and isolate the physical resources (CPU, memory, i/o) used by process groups. Cgroups can respectively form a tree structure composed of multiple sub cgroups, according to different resource types, so as to uniformly control the overall resource usage from top to bottom.

  1. The pod creates a cgroups hirarchy
  2. Containers in the pods share the cgroup hierarchy
  3. cgroup allows a container to take turn and use the compute resources
  4. So, the number of containers within a pod depends solely on the resource availability on that node

Upvotes: 4

Deepak Mourya
Deepak Mourya

Reputation: 430

Just want to add kubernetes doc link for the above answer https://kubernetes.io/docs/setup/best-practices/cluster-large/

Upvotes: 4

Kamol Hasan
Kamol Hasan

Reputation: 13566

AFAIK, there is no such pod-specific limit. Though there are some cluster-specific criteria (k8s v1.21) like:

  • No more than 110 pods per node
  • No more than 5000 nodes
  • No more than 150000 total pods
  • No more than 300000 total containers

N.B.: Since a pod can be scheduled to a single node, you are also limited by node resources (ie. cpu, memory). So, when you increase the number of containers of a pod, make sure that your node has enough resources to accommodate your pod.

Upvotes: 14

Related Questions