Kubernetes Resource Requests and Resource Limits

Maciej
7 min readJan 11, 2021

What is Resource Requests ??

It is mechanism that allows you to specify the resources (CPU/memory) required when deploying a pod, however, the pod can use more resources than the specified resource requests. We should use limit resource usage.

The specified resource is not reserved for the pod it is just for checking if the resource amount is free when deploying the pod. Key point is that when deploying a pod, the resource usage of node is not seen, but resource requests are seen for deployment.

So basically even if the resource like CPU or memory usage of node is 100%, it will be deployed if there is space in resource requests. It will not be deployed to a node that is full.

Quick case:

We have a node with 1G of memory and two pods with resource requests of 400MB are deployed, the third cannot be deployed. When we will try to deploy, then the STATUS of that pod will be Pending.

root@vagrant:/home/vagrant# cat test.yaml
apiVersion: v1
kind: Pod
metadata:
name: test-pod
spec:
containers:
- image: busybox
command: ["dd", "if=/dev/zero", "of=/dev/null"]
name: main
resources:
requests:
cpu: 200m
memory: 10Mi

Explanation:

  • cpu 200m: is an abbreviation for 200 milli cores. (1 cpu =1000 milli cores)

Let’s try specifying Resource Requests

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

No responses yet