Kubelet配置 [英] Kubelet Configuration
问题描述
我在某些kubernetes节点上的CentO上遇到OOM问题.我想像在演示中一样进行设置:
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%
我在哪里添加这些参数?
我应该将它们添加到/etc/systemd/system/kubelet.service吗?
什么格式?
另外,我是否只是在工作节点上设置了这些?
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
推荐答案
将它们添加到此文件中(希望您使用kubeadm启动了集群):
Add them to this file (hopefully, you initiated your cluster with kubeadm):
/var/lib/kubelet/kubeadm-flags.env
例如:
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>
运行:
systemctl restart kubelet
和配置应生效.您可以使用以下正确的参数检查kubelet是否正在运行:
and configs should take effect. You can check the kubelet is running with the right parameters like this:
ps -Af | grep kubelet
希望有帮助.
这篇关于Kubelet配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!