How to limit allocatable memory per node on Kubernetes?

1.7k views Asked by At

I would like to limit allocatable memory per node (VM) on Kubernetes.

Now it seems that certain pods can grow over the memory limit of VM making it unresponsive instead of killing pods before that happens.

1

There are 1 answers

0
silverfox On BEST ANSWER

See Reserve Compute Resources for System Daemons.

In the systemd, we can configure kubelet with Node Allocatable feature like this.

$ cat > /etc/systemd/system/kubelet.service.d/20-node-eviction.conf <<EOF
Environment="KUBELET_EXTRA_ARGS=--eviction-hard=memory.available<500Mi --system-reserved=memory=1Gi"
EOF
$ systemctl daemon-reload