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.
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