Kubernetes resource request/limit values

5/15/2019

For setting these values, it is unclear as to what the best practices are. Is the following an accurate generalization ?

Memory and CPU request values should be slightly higher than what the container requires to idle or do very minimal work.

Memory and CPU limit values should be slightly higher than what the container requires when operating at maximum capacity.

References:

-- s g
docker
kubernetes

1 Answer

5/15/2019

Request values should be set around the regular workload numbers. It shouldn't be close to the idle work numbers because request values are what the Scheduler uses to determine where to put Pods. More specifically, the Scheduler will schedule Pods on a Node as long as the sum of the requests is lower than the Node maximum capacity. If your request values are too low, you risk overpopulating your Node, causing some of the Pods to get evicted.

For the limit, it should be set at the value at which point you consider it ok for the Scheduler to evict the Pod where the container is running. It should be larger than a regular high load or your Pod risks getting evicted whenever it experiences a peak in workload.

-- Alassane Ndiaye
Source: StackOverflow