我想更改kubelet日志目录位置。为了达到相同的目的,我对/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
文件的内容进行了如下修改(如how to change kubelet working dir to somewhere else中所述)
# 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="KUBELET_EXTRA_ARGS=--root-dir=/D/kubelet-files/ --log-dir=/D/kubelet-logs/"
# 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_EXTRA_ARGS $KUBELET_KUBEADM_ARGS
此后,我执行了命令:
systemctl daemon-reload
systemctl restart kubelet
即使我重新启动了kubeadm
。但是日志目录的位置仍然保持不变,并且继续写入默认的/var/lib/kubelet
目录。我正在使用Kubernetes version: v1.11.2
。可能是什么问题?
答案 0 :(得分:1)
我已经用v1.11.2
在GCloud上的某些机器上尝试过
我注意到了您的问题。
kubelet中的参数--log-dir
似乎无效。
值得在kubelet项目中打开一个问题。