0

Say I have resource requests and limits set to

resources:
  requests:
    cpu: "100m"
    memory: "512Mi"
  limits:
    cpu: "500m"
    memory: "1024Mi"

and targetCPUUtilizationPercentage set to 80,

so when more than 80m of CPU is utilized by pods on average, it will auto-scale.

So, what i want to understand is that the resource limit in this case will be useless, right? Or, does it play any role?

Zain
  • 57
  • 2
  • 9
  • 1
    `resrouces.limits.cpu` throttles container CPU use, regardless how many pods run across the cluster. You may have 1000 of them deployed with the help of HPA, but each of them may not use more than `resrouces.limits.cpu` cpu shares. – zerkms Oct 22 '20 at 05:52

1 Answers1

1

As Zerkms has said the resource limit is per container.

Something else to note: the resource limit will be used for Kubernetes to evict pods and for assigning pods to nodes. For example if it is set to 1024Mi and it consumes 1100Mi, Kubernetes knows it may evict that pod.

If the HPA plus the current scaling metric criteria are met and Kubernetes is supposed to scale up the replicaset it will check the memory of the nodes and the memory requests of the pods before scheduling a pod for a node.

Justin Tamblyn
  • 719
  • 8
  • 21