Does any pod consume all the resources specified in resource limits?

5/4/2019

I would like to know, if the memory request of a pod is 200m and the limit is 400m, what would be the memory resource consumtion? Does it always consume all 400m which is specified in limits or it can be lower than that?

-- HamiBU
kubernetes

1 Answer

5/4/2019

In short, yes it can be lower than what is specified in limits. But, it is not about consumption but about allocation. Requests mean pod is guaranteed to be allocated this amount of memory where as limits specify at max what will be allowed to used/claimed by pod.

Although, it might seem that it controls resource usage but they have more impacts on node selection (for pod scheduling) and horizontal auto-scalers.

Please note that memory usage is not elastic in nature as cpu because once pod/container is granted memory usually applications dont have mechanism to give it back to node. So, at times it might appear that load has decreased on pod but memory claimed/consumed is not given back.

-- Prateek Jain
Source: StackOverflow