We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Resource Requests

We talked about resource limits, but there's another critical concept to understand: resource requests.

A resource request is the amount of a resource that a pod requests from the node it's running on. A resource limit, on the other hand, is the maximum amount of a resource that a pod is allowed to consume before it's throttled or killed.

Why Do We Need Requests?

Let's say we have 2 nodes:

Node RAM
Node 1 8GB
Node 2 8GB

And we have 4 pods:

Pod Node RAM
Pod 1 Node 1 3GB
Pod 2 Node 1 3GB
Pod 3 Node 2 3GB
Pod 4 Node 2 3GB

This is valid. Currently, only 6/8 GB of RAM is being used on each node. The trouble is, even though each node has 2GB of RAM left, if we try to add another pod, and it ends up utilizing more than 2GB of RAM (like the 3GB it will likely need), it will crash.

Resource requests solve this.

If we add a resource request of 3GB, Kubernetes will know that each pod needs 3GB of RAM to run. If we try to schedule a new pod with the request in place, k8s will gracefully tell us it doesn't have enough resources to do so, or it will use a node in the cluster that has at least 3GB of RAM available.

Assignment

Let's set an absurdly high resource request for our synergychat-testram pods.

resources:
  limits:
    memory: 40000Mi
  requests:
    memory: 40000Mi

Apply the deployment, then check on your pods:

kubectl get pods

You should see that the pod is "Pending". If it worked... well you have more money than me to spend on hardware. Go even higher!

kubectl describe pod <pod-name>

Run and submit the CLI tests.