Kubernetes 101 : Defining default resources requests and limits for pods



In case we have no idea before hand about how much resources - CPU, RAM - an application running inside pods would need, we could set default resource limits and resource requests for our pods using the kubernetes object "LimitRange".

Below is an example of a LimitRange object:


The resource requests is what the pod gets when it starts. If the pod needs more resources, it can't get more than what is set in the resource limits. 

Remark:

The LimitRange object can help us set default resources for a whole namespace if we "apply" that limit to a namespace using the below command:


If we don't mention a particular namespace, the limit will apply to the default namespace and the pods that don't explicitly define resource limits and resource requests, will use the default ones.

Comments

Leave as a comment:

Archive