gpt4 book ai didi

kubernetes - Kubernetes CPU 限制是如何实现的?

转载 作者:行者123 更新时间:2023-12-03 09:57:36 24 4
gpt4 key购买 nike

Kubernetes CPU 限制是“硬”限制吗?

假设我有一个带有 1 个 CPU 的节点,其中有两个 Pod 已调度并正在运行/就绪/事件,每个节点都有 requests.limits.cpu 500m。 Pod A 使用 1 个 CPU 一段时间——这是正常/允许的。最终,pod B 需要一些 CPU。 Kubernetes(或 Linux)会确保 pod B 能够获得它要求的 0.5 CPU 吗?

2016 年 6 月 23 日星期四 16:55:25 UTC 更新

我仍在寻找明确的答案,但听起来这些可能是 Linux/Docker 中的硬限制。 @danielmartins wrote thisk8s slack channel :

I believe you can find this out by running docker inspect on the containers in which you set the limits. Checking one of my containers, I see that Kubernetes set CpuPeriod, CpuQuota for them. The Docker docs (https://docs.docker.com/engine/reference/run/) mention the CFS documentation (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt), and from the information there, it seems that these are hard limits

最佳答案

Kubernetes 只是管理容器。据我所知,实际上是容器引擎(Docker、rkt)实现了CPU的限制。正如您已经观察到的那样,该限制不是硬性限制。而是可用资源的百分比。

Kubernetes(如果为此设置了监控),获取使用过的资源值并使用它们来确定您是否需要一个新的 pod(假设您已经设置了一些自动缩放)。 Kubernetes 无法对现有 Pod 进行速率限制,因为它实际上并未运行 Pod 中的容器。

关于kubernetes - Kubernetes CPU 限制是如何实现的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37975366/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com