简体   繁体   中英

How to set Memory limit for a pod in Kubernetes

I have a node with 6gb memory. I want to run 2 pods on it.

Question 1:

在此处输入图片说明

POD1 have Request of 4GB and limits of 6GB and POD2 has no limit.
POD1 is working at 4GB and that leaves 2GB of memory free on node.
Can Kubernetes allocate POD2 in this node?
or will it be in Pending with You don't have enough resources ?

If Kubernetes run this Pod2 in this node, can POD2 grow into POD1's allocated 4GB memory??
In other words, can Pod2 use memory allocated for Pod1??

Question 2:
Will this setup(pic2) work?

在此处输入图片说明

The scheduler ensures that, for each resource type, the sum of the resource requests of the scheduled Containers is less than the capacity of the node.

If a Container exceeds its memory limit, it might be terminated. If it is restartable, the kubelet will restart it, as with any other type of runtime failure. If a Container exceeds its memory request, it is likely that its Pod will be evicted whenever the node runs out of memory.

Can Kubernetes allocate POD2 in this node?

Yes but only if it does not have requests more than 2GB.

If Kubernetes run this Pod2 in this node, can POD2 grow into POD1's allocated 4GB memory?? In other words, can Pod2 use memory allocated for Pod1??

No.

Question 2: Will this setup(pic2) work?

The scheduler will schedule it. But pod will be evicted if total memory consumption goes beyond the capacity of the node.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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