赞
踩
一.现状和问题现象
公司kubernetes集群是通过kubeadm工具安装的,使用1年之后证书到期。在 kubernetes control plane maste节点服务器上运行 kubeadm certs renew all
命令更新证书后,kubelet 无法正常启动,报错日志如下
Failed to run kubelet" err="failed to run Kubelet: unable to load bootstrap kubeconfig: stat /etc/kubernetes/bootstrap-kubelet.conf: no such file or directory
二.处置思路
针对master节点
- 1.针对单master节点或者多master节点但是无VIP地址的
- $ cd /etc/kubernetes/pki/
- $ mv {apiserver.crt,apiserver-etcd-client.key,apiserver-kubelet-client.crt,front-proxy-ca.crt,front-proxy-client.crt,front-proxy-client.key,front-proxy-ca.key,apiserver-kubelet-client.key,apiserver.key,apiserver-etcd-client.crt} ~/
- $ kubeadm init phase certs all
- $ cd /etc/kubernetes/
- $ mv {admin.conf,controller-manager.conf,kubelet.conf,scheduler.conf} ~/
- $ kubeadm init phase kubeconfig all
- $ reboot #本步骤不必须,如果有异常可以重启
- $ cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
-
- 2.针对多master节点高可用,存在VIP地址的,下面的VIP地址替换成对应的IP
- $ kubeadm init phase certs all --control-plane-endpoint "VIP:6443"
- $ kubeadm init phase kubeconfig all --control-plane-endpoint "VIP:6443"
这对worker节点
- 登录到对应的worker节点,拷贝 admin.conf 到 kubelet.conf ,再重新启动kubelet服务
-
- cp -a /etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf
-
- systemctl daemon-reload && systemctl restart kubelet
-
- #如果以上处理异常,可针对worker节点删除,重新添加
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。