Resource Requests, "The Minimum Required Resources":

A pod can request the resources needed to run its containers.
Pods can request that a container gets scheduled on a machine that could provide it with a quarter of a CPU resources, and 256 MiB of RAM for example.

We define that in the pod's Yaml file as below:


The resources are specific to the containers, not to the Pod, because a pod could host different containers with different needs in terms of resources.
The resources requested by a pod are the total of the resources needed by its containers.

Resource requests and the scheduler:

The kubernetes scheduler uses the requests to assign pods to nodes that fit the requirements of the containers.
The request tells the scheduler about the minimum resources needed by containers.

A pod scheduled on a two CPUs node with a request of "250m", will use the two CPUs.
If another three replicas of the same pod get scheduled on the same node, all four pods will get "250m" - a quarter - of CPU each.

In any case the pod is guaranteed a minimum of "250m" CPU.

Using Limits:

Requests tell kubernetes about the minimum amount of resources required by a Pod.
We can also define the maximum amount of resources for a pod using a resource limit.

We could have a limit of "1.5" CPU and "512 MiB" of RAM for example, as it is shown in the below Yaml file for a pod:


A container will not be allocated a CPU count beyond the limit of "1.5 cores" and it will not get more than "512Mi" of RAM.
Brando Sabatini and Ikbal C ©. Powered by Blogger.