修改kubelet启动参数

Posted dev0ps

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了修改kubelet启动参数相关的知识,希望对你有一定的参考价值。

我是用kubeadm安装的k8s,现在通过Aqua扫描出相关配置问题,需要修改kubelet的启动参数;

默认配置文件名为:10-kubeadm.conf

#vim /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
Environment="KUBE_ALLOW_PRIV=--allow-privileged=false"

# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/sysconfig/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS $KUBE_ALLOW_PRIV

 例如我添加了然后在ExecStart也需要加key:

KUBE_ALLOW_PRIV=--allow-privileged=false

加载配置文件重启kubelet

# systemctl stop kubelet
# systemctl daemon-reload
# systemctl start kubelet

  

以上是关于修改kubelet启动参数的主要内容,如果未能解决你的问题,请参考以下文章

Kubelet 服务启动失败

Kubelet 服务启动失败

腾讯云tke容器服务调整kubelet工作目录

全新一台node节点加入到集群中

k8s修改node主机名

kubernetes之kubelet运行机制分析