本文介绍了Kubernetes:了解资源请求/限制和调度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解时间表在某些情况下的行为方式/原因.有人可以解释在这些情况下调度程序会做什么(为什么)吗?

I'm trying to understand how/why the schedule behaves with certain circumstances. Can someone explain what the scheduler would do (and why) in these scenarios?

假设我有一个10GB的存储盒

Assume I have a 10GB memory box

我有一个容器,其内存请求设置为1G.我运行了10个副本,我希望在同一个盒子上看到所有10个副本(对于这种情况,请忽略任何kube系统样式的pod)

I have a container with memory request set to 1G. I run 10 replicas of it, I expect to see all 10 on the same box (ignore for this case, any kube-system style pods)

现在假设我还将内存限制设置为2G.怎么了?对我来说,这对调度程序说:此Pod要求1G,但可以增长到2G" —调度程序是否仍将所有10个设备放在同一个盒子中,知道它很可能必须将其中的一半踢掉?还是会分配2G,因为这就是上述限制?

Now assume I also add memory limit set to 2G. What happens? To me, this says to the scheduler "this pod is asking for 1G but can grow to 2G" -- would the scheduler still put all 10 on the same box, knowing that it might very well have to kick half of them off? Or will it allocate 2G as that's the limit described?

如果我不声明限制的话,那么我会正确吗?如果没有声明限制,那么pod将会增长,直到节点内存不足,然后杀死超出其请求资源的pod为止?还是会采用某种默认设置?

Would I also be correct in assuming that if I don't declare a limit, that the pod will grow until the node runs out of memory then kills pods that have exceeded their request resource? Or would it assume some kind of default?

推荐答案

请求是需要在节点上专门提供给该pod进行调度的内容.这是从可用资源计数中扣除的.极限就是极限.吊舱使用量将限制为该值.

Requests is what needs to be provided on node exclusively to that pod for it to schedule. This is what is taken off the available resource count. Limits are, well, limits. The pod usage will get limited to that value.

因此,如果您有10G节点,并想放入其上的req: 1G, limit: 2G盒中,则可以容纳其中的10个,并且如果有足够的未使用内存,它们将能够达到2G内存使用量其他请求(例如,您请求1G,但实际上使用了700M,这大约为您提供了3G的请求,但没有可用的空间,这些空间可用于Pod扩展到2G的限制.

So, if you have 10G node, and want to fit in req: 1G, limit: 2G pods on it, you will be able to fit 10 of them, and they will be able to bursts to 2G memory usage if there is enough unused memory from the others (ie. you request 1G, but really use 700M, which gives you roughly 3G requested, but not used space which will be available for bursting to the 2G limit by the pods.

这篇关于Kubernetes:了解资源请求/限制和调度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 08:45