https://kubernetes.io/docs/tasks/administer-cluster/reconfigure-kubelet/ 嗨,我在遵循本教程时遇到了一些麻烦。建议使用configmap重新配置kubelet,但是当我使用“kubectl edit node”来修改kubelet配置时,虽然显示“node *** edited”的输出没有改变,但ConfigOk状态没有显示在节点中状态。有关更多信息,可以成功创建configmap,相应角色和角色绑定。有什么我错过了或本教程需要更新? 我已经尝试了很多次,并且坚持Observe that the Node begins using the new configuration步骤。我想知道是否需要将节点设置到系统中:节点组或其他任何我错过的东西?谢谢!
答案 0 :(得分:1)
对于由Kubeadm支持的节点,动态配置-https://kubernetes.io/docs/tasks/administer-cluster/reconfigure-kubelet/截至目前(v1.17.0)无效
另请参见https://github.com/kubernetes/kubernetes/issues/67580
有一个选项可以通过kubeadm启用它
kubeadm alpha kubelet config enable-dynamic --node-name azuretest-2 --kubelet-version 1.17.0
[kubelet] Enabling Dynamic Kubelet Config for Node "azuretest-2"; config sourced from ConfigMap "kubelet-config-1.17" in namespace kube-system
[kubelet] WARNING: The Dynamic Kubelet Config feature is beta, but off by default. It hasn't been well-tested yet at this stage, use with caution.
但是,这行不通;即使设置了此设置并遵循
kubectl edit node ${NODE_NAME}
....
spec:
configSource:
configMap:
kubeletConfigKey: kubelet
name: my-node-config-dtghm9gbd2
namespace: kube-system
[centos@azuretest-1 ~]$ kubectl get no ${NODE_NAME} -o json | jq '.status.config'
null
有效的方法-在所有工作节点中手动编辑都会添加您要编辑的配置(https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/)
[root@azuretest-2 ~]# cat /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--cgroup-driver=systemd --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.1 --container-runtime=remote --container-runtime-endpoint=/var/run/containerd/containerd.sock --resolv-conf=/etc/resolv.conf --max-pods=700"
systmectl daemon-reload
systemctl restart kubelet