ankit patel
ankit patel

Reputation: 1469

what is kubernetes memory commitment limits on worker nodes?

I am running single node K8s cluster and my machine has 250GB memory. I am trying to launch multiple pods each needing atleast 50GB memory. I am setting my pod specifications as following.

enter image description here

Now I can launch first four pods and they starts "Running" immediately; however the fifth pod is "Pending". kubectl describe pods shows 0/1 node available; 1 insufficient memory

now at first this does not make sense - i have 250GB memory so i should be able to launch five pods each requesting 50GB memory. shouldn't i?

on second thought - this might be too tight for K8s to fulfill as, if it schedules the fifth pod than the worker node has no memory left for anything else (kubelet kube-proxy OS etc). if this is the case for denial than K8s must be keeping some amount of node resources (CPU memory storage network) always free or reserved. What is this amount? is it static value or N% of total node resource capacity? can we change these values when we launch cluster?

where can i find more details on related topic? i tried googling but nothing came which specifically addresses these questions. can you help?

Upvotes: 0

Views: 669

Answers (1)

Jonas
Jonas

Reputation: 128807

now at first this does not make sense - i have 250GB memory so i should be able to launch five pods each requesting 50GB memory. shouldn't i?

This depends on how much memory that is "allocatable" on your node. Some memory may be reserved for e.g. OS or other system tasks.

First list your nodes:

kubectl get nodes

Then you get a list of your nodes, now describe one of your nodes:

kubectl describe node <node-name>

And now, you should see how much "allocatable" memory the node has.

Example output:

...
Allocatable:
  cpu:                4
  memory:             2036732Ki
  pods:               110
...

Set custom reserved resources

K8s must be keeping some amount of node resources (CPU memory storage network) always free or reserved. What is this amount? is it static value or N% of total node resource capacity? can we change these values when we launch cluster?

Yes, this can be configured. See Reserve Compute Resources for System Daemons.

Upvotes: 1

Related Questions