0

I have been reading through the docs but it still is not clear as to why I should use one or the other. They have great examples of how to configure them but don't answer the why for quotes or limits very well.

I want to understand

kind: ResourceQuota

and

kind: LimitRange

I am not so interested in the yaml this is very clearly given in the examples. I want to understand the use-cases better.

2

ResourceQuota is

the total amount of memory and CPU that can be used by all Containers running in a namespace

LimitRangeis

if ... the Container does not specify its own CPU limit, then the Container is assigned the default CPU limit

  • Example of ResourceQuota:

Imagine you have 2 namespaces in the same cluster, the namespace "backup" and namespace "test". "backup" run critical pods and you want to guarantee that will always have enough resources (CPU and memory) to run it. So you can configure a ResourceQuota in the namespace "test" to use only a part of the total amount of CPU and memory in your cluster.

Is like you say to k8s: "The sum of all memory and CPU of all pods in the namespace "test" can't be higher than what is specified in the ResourceQuota, 20G for memory and 12 vCPU's"

  • Example of LimitRange:

You can specify in the yaml the minimum and maximum amount of CPU and memory a container can consume but instead of configuring in every yaml file you can set a default value with LimitRange.

Is like you say to k8s: "If there is no resource configured in the yaml file apply this LimitRange.

1
  • Limits set default constraints per container/resource. Does quota set the resource constraints per namespace, for all resources in the namespace? Even ones without a limit set? – nelaaro Mar 5 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.