Kubernetes 101 : Resource Quotas (ResourceQuota) and Limit Ranges (LimitRange)
Resource quotas are limits applied to system resources. They are enforced at the namespace level.
They offer us a way to keep the applications running inside the containers from "over-consuming" system resources ( CPU and RAM ).
Quotas and namespaces:
Quotas are tied to namespaces, we can have different quotas in different namespaces.
Below is a Yaml file of a quota "quota-file":
* requests.cpu: the total CPU "mcores" that all the containers in the namespace can have.
* requests.memory: total memory that all the containers in the namespace can have.
* limits.cpu: maximum limit that all the containers in the namespace can have.
* limits.memory: the maximum limit of memory that all the containers in the namespace can have.
* limits.cpu: maximum limit that all the containers in the namespace can have.
* limits.memory: the maximum limit of memory that all the containers in the namespace can have.
Remark:
"mcores" means "mili-cores". For example "250mcores" is the quarter of a CPU resources and "500mcores" is half of a CPU resources.
We can create the quota using the below command:
Limit ranges:
The limit range is a kubernetes resource that is enforced at the container level.
Below is a Yaml file of a LimitRange resource:
To create our LimitRange object we use the below command:
Remark:
All the container created in that namespace "namespace_name", will be subjected to the above limits.
Comments