Home > Software engineering >  Why is my deployment not using the requested cpu in Kubernetes MInikube?
Why is my deployment not using the requested cpu in Kubernetes MInikube?

Time:05-10

I have created a deployment with the following resources:

resources:
      requests:
        memory: "128Mi"
        cpu: "0.45"
      limits:
        memory: "128Mi"
        cpu: "0.8"

Using the minikube metrics server I can see that my pod CPU usage is below the requested of 450m and is only using around 150m. Shouldn't it always use 450m as a minimum value since I requested it in my .yaml file? The CPU usage goes up only if I dramatically increase the workload of the deployment. Can I have my deployment use 450m as baseline and not go below that value?

CodePudding user response:

The requested value is a hint for the scheduler to help good placement of the workload. If your application does not make use of the requested resources, this is fine. The limit will ensure no more resources are used: For CPU it will be throttled, if more RAM is used, the workload is killed (out of memory).

  • Related