简体   繁体   English

Kubernetes资源请求

[英]Kubernetes resource requests

Is setting a resource request in a container allocates a resource? 在容器中设置资源请求是否分配了资源? Let us say I set a 1 CPU request, will that allocate a 1 CPU to that pod? 假设我设置了一个1 CPU请求,那会为那个Pod分配一个1 CPU吗?

Or is resource request just like a threshold or an identifier if that pod with a resource request can be deployed to this instance based on available resources? 还是资源请求可以像阈值或标识符一样,如果可以根据可用资源将具有资源请求的那个容器部署到该实例?

There are separately resource requests and resource limits . 分别有资源请求和资源限制

Resource requests are mostly used for scheduling . 资源请求 主要用于调度 If you have a node with 8 CPU cores and 32 GB of RAM, Kubernetes won't schedule pods to run on that node that, combined, request more than 8.0 CPU cores and 32 GB memory. 如果您的节点具有8个CPU内核和32 GB的RAM,则Kubernetes不会调度Pod在该节点上运行,而这些节点合起来需要8.0个以上的CPU内核和32 GB的内存。 (That includes any number of pods that have no resource requests at all.) The one exception is that, if you request some amount of CPU, that gets passed on to Docker and if the system is overloaded, process time is allocated proportional to the requested CPU count. (这包括任何数量的根本没有资源请求的Pod。)一个例外是,如果您请求一定数量的CPU,它将传递给Docker,并且如果系统超载,则处理时间将与请求的CPU数量。 Neither cores nor memory are "reserved" in any meaningful way (you're not guaranteed to run on a single specific core if you request 1 CPU unit). 内核和内存都不会以任何有意义的方式“保留”(如果您请求1个CPU单元,则不能保证在单个特定内核上运行)。

Resource limits affect the pod's operation . 资源限制 会影响广告连播的操作 Kubernetes will limit a pod's CPU consumption based on the requested CPU limit, and if it goes over its memory limit, the Linux kernel will kill it (described in extended discussion of the docker run -m option ). Kubernetes将根据请求的CPU限制来限制Pod的CPU消耗,如果超过了内存限制,Linux内核将终止它(在docker run -m选项的扩展讨论中进行了描述)。 Remember that pods are scheduled based only on their resource requests, so it's possible to have a collection of pods that together don't request more than available memory but do wind up using too much memory, and in this case the kernel OOM-killer will wind up killing something off too. 请记住,pod仅根据其资源请求进行调度,因此有可能有一组pod在一起,它们的总请求量不超过可用内存,但最终会占用过多的内存,在这种情况下,内核OOM-killer会结束也杀死了一些东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM