Limiting cpu for a set of pods
A good strategy here would be to play with both requests and limit parameter of resources.
As an example for your case, you can use following configuration
resources.requests.cpu
- 750mCresources.limits.cpu
- 2000mC
This will allocate 3000m (740 x 4) CPU in the node, allowing additional 1000mC for CPU to burst.
My suggestion would be to enable pod auto scaling. There are 2 types of it:
Horizontal Pod Autoscaler (HPA) - If your pods are identical and you do not require all 4 at once, then implement HPA for Pods. With this you can keep a minimum number of pods you require and then scale them to the maximum number you want based on metrics like CPU, Memory utilisation etc. HPA
Vertical Pod Autoscaling (VPA) - You can implement VPA by utilizing the resource management provided by kubernetes. You can add parameter
resources.requests.cpu
to start your pod with and in case the utilisation increases you can limit it using parameterresources.limits.cpu
. Resource management
Combination of both above methods will be ideal in your case.