Hello,
I was wondering if it was really relevant to set “requests” (CPU/MEM) values if I’m not using HPA ?
If those values are not used to scale up or down some pods, what is the point ?
Regards,
Camille.
That’s how: a) the scheduler knows how many pods to put into a node and when that node is “full”; and b) the node knows how to configure the kernel to share resources between pods, rather than being a free for all.
So, “yes”.
Thank you very much for this very clear answer.
Do I really have to follow the recommendations to set the values?
For example, for Velero, the recommended requests seem to be 500Mi but, in reality, most of the time the pod consumes only 2Mi. Can I put 2Mi or 5Mi for example without affecting the application? Or can there be unexpected behavior or bugs?
So in summary, is a too low Request can affect the behavior of a pod? Even if I set a very high Limit?
The request is what you are “guaranteed”. You might be able to use more than that, if it is available on the machine when you need it, but it might not be available. You should always be able to use what you have requested.
It’s also worth pointing out that CPU and memory are fundamentally different things. The impact of too little CPU is that you go slower. The impact of too little memory is that you crash. Likewise, “borrowed” CPU is easily reclaimed, but borrowed memory could cause you to be killed (or worse, cause someone else to be killed).
Soy general guidance is:
- always set CPU request
- never set CPU limit
- always set memory request
- always set memory limit == request
Reasonable people disagree with me, especially on CPU limits.
We find that K8s specialists always set requests for all deployments. Limits are used half the time in what I can tell. Regardless of HPA I’d always set requests, but I’d use tools that can dynamically scale those resources at runtime.
More than happy to share what we’re using from a tooling perspective if anyone is interested. Just DM Me.
@Deeb-K8s
I am interested in what tool do you use.
Thx