ResourceQuota
is
the total amount of memory and CPU that can be used by all Containers running in a namespace
LimitRange
is
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"
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.