Kubelet Configuration

谁说胖子不能爱 提交于 2020-01-03 19:29:14

问题


I am running into OOM issues on CentOs on some kubernetes nodes. I would like to set it up like they have in the demo:

--kube-reserved is set to cpu=1,memory=2Gi,ephemeral-storage=1Gi
--system-reserved is set to cpu=500m,memory=1Gi,ephemeral-storage=1Gi
--eviction-hard is set to memory.available<500Mi,nodefs.available<10%

Where do I add those params?
Should I add them to /etc/systemd/system/kubelet.service? What format?
Also, do I just set these on the worker nodes?

This is in a live enviroment so I want to get it right on the first go.

[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=https://kubernetes.io/docs/

[Service]
ExecStart=/usr/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10

[Install]
WantedBy=multi-user.target

回答1:


Add them to this file (hopefully, you initiated your cluster with kubeadm):

/var/lib/kubelet/kubeadm-flags.env

For example:

KUBELET_KUBEADM_ARGS=--cgroup-driver=cgroupfs --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d --network-plugin=cni --resolv-conf=/run/systemd/resolve/resolv.conf --kube-reserved=<value> --system-reserved=<value> --eviction-hard=<value>

Run:

systemctl restart kubelet

and configs should take effect. You can check the kubelet is running with the right parameters like this:

ps -Af | grep kubelet

Hope it helps.



来源:https://stackoverflow.com/questions/52416671/kubelet-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!