一个 Pod 中最多可以 运行 个容器?

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

我知道一个 pod 可以有多个容器。但是,我正在尝试查找 pod 中的容器数量是否有最大限制。我用谷歌搜索,但找不到答案。

据我所知,没有这种特定于 pod 的限制。尽管有一些特定于集群的标准 (k8s v1.21),例如:

  • 每个节点不超过 110 pods
  • 不超过 5000 个节点
  • 总计不超过150000pods
  • 容器总数不超过 300000 个

N.B.:由于一个pod可以调度到单个节点,你也受限于节点资源(即cpu,内存).所以,当你增加一个 pod 的容器数量时,请确保你的节点有足够的资源来容纳你的 pod。

只想为上述答案添加 kubernetes 文档 link https://kubernetes.io/docs/setup/best-practices/cluster-large/

不限-只要节点能满足资源需求

经过进一步研究,我发现了以下内容:

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. pod 创建一个 cgroups hirarchy
  2. pods 中的容器共享 cgroup 层次结构
  3. cgroup允许容器轮流使用计算资源
  4. 因此,一个 pod 中的容器数量完全取决于该节点上的资源可用性