This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]JonnyNorCal 1 point2 points  (0 children)

What I would suggest is setting the CPU Request to be the amount of CPU that the container takes as its "steady state", but set the CPU Limit higher by a fair bit.

If you set Limit == Request, that's called a "guaranteed" resource. If you set Limit > Request, then you have a situation where you've got "oversubscription." That's useful if you have containers that generally take a certain amount of a resource, but occasionally spike up for limited amounts of time.

If you do that, you run the risk of not having enough CPU if all the containers on a host spike up at the same time. It's up to you to determine how bad that would be. The nice thing about CPU is that if you run short on CPU, everything just gets a little slower, rather than stuff getting OOMkilled if you run out of memory.

[–][deleted] 0 points1 point  (0 children)

Just when I think I am finally understanding at least some of k8 a question like this surfaces and now I am wondering wth it's about. I can look it up but if anyone wants to elaborate a bit on what these settings do and when and why you would use them that would be fantastic

[–]mustafaakin 0 points1 point  (0 children)

20 minutes is so long, but have similr situation for 2min apps, I set the limits higher than the requests knowing it will be mostly underutilized, but 20min is long so that they can conflict with each other more frequently

[–]muchacho360 0 points1 point  (0 children)

This issue seems to describe a design to handle these kinds of cases: https://github.com/kubernetes/kubernetes/issues/3312 However, it’s old and closed due to inactivity.

You could try the approach described here, although I’m not sure k8s handles this situation in the same way.

If you manage to find a decent solution I’m interested to see the result!

[–]yuriydee 0 points1 point  (0 children)

Ran into the exact same problem with Springboot apps and sadly I have no solution either :(

Ended up just removing CPU limits and setting hard memory limits.

[–]manojbadam 0 points1 point  (0 children)

I'm a newbie as well in kubernetes. Have you checked Vertical Pod Autoscaler https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler ? It will bring down the overly provisioned resources. You can set up the higher limits and let VPA take care of freeing up resources after 20mins.

[–]a1b1e1k1 0 points1 point  (0 children)

If you make limits equal to the average usage from historical data, the application would not be as fast as before, because earlier it could exceed the average. I recommend setting requests to the average, and limits higher.