Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

CPU Limit for a group of containers on Kubernetes or any other orchestration tool

I can set CPU limits for individual containers on Kubernetes. I have an application running on my cluster. It has 6 different containers running in separate pods. I want to set a limit of 8 vCPUs for this app. I don't want to limit individual containers as this will degrade the performance but I also don't want to assign 8 vCPUs to each of the containers as that will be a waste of resources. Is there any way to do this in Kubernetes or any other orchestration tool?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can deploy all 6 pods in a dedicated namespace and then add a CPU limit on the whole namespace using ResourceQuota

Your ResourceQuota for that namespace would look something like:

apiVersion: v1
kind: ResourceQuota
metadata:
  name: appNamespace-quota
spec:
  hard:
    limits.cpu: "8"

You can apply this resource in that namespace.

More information about ResourceQuota can be found here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...