kubeadm方式安装kubernetes集群,kubetlet的证书过期
kubeadm方式安装kubernetes集群,kubetlet的证书过期背景:有node所在的主机重启了,服务器启动后kubelet启动不了;[root@master ~]# kubectl get nodes有发现有Node处于NotReadly查看日志如下:Part of the existing bootstrap client certificate is expired: 2021-0
·
kubeadm方式安装kubernetes集群,kubetlet的证书过期
背景:有node所在的主机重启了,服务器启动后kubelet启动不了;
[root@master ~]# kubectl get nodes
有发现有Node处于NotReadly
查看日志如下:
Part of the existing bootstrap client certificate is expired: 2021-08-05 00:33:57 +0000 UTC
failed to run Kubelet: unable to load bootstrap kubeconfig: stat /etc/kubernetes/bootstrap-kubelet.conf: no such file or directory
kubernetes的集群有两种证书,一个是用于集群间通讯的,另一个是用于kubetlet的;之前部署的人说kubetnetes的证书是10年的有效期;
# 可以通过一下命令查看kebetlet证书有效期:
openssl x509 -noout -text -in kubetlet.crt | grep Not
# 集群版本1.14以上可以使用命令查看集群证书是否过期:
kubeadm alpha certs check-expiration
更新主节点证书,如果没有过期,就不用更新:
# 备份证书
[root@master ~]# cp -r /etc/kubernetes /etc/kubernetes-bak
[root@master ~]# rm -rf $HOME/.kube
[root@master ~]# mkdir -p $HOME/.kube
[root@master ~]# cp -i /etc/kubernetes/admin.conf /root/.kube/config
[root@master ~]# rm -rf /etc/kubernetes/*.conf
# 生成新配置文件和证书
[root@master ~]# kubeadm init phase kubeconfig all
# 删除NotReadly的Node
[root@master ~]# kubectl delete node b-node2
更新节点证书:
# 查看加入集群的命令,在主节点执行;
[root@master ~]# kubeadm token create --print-join-command
kubeadm join 192.168.0.20:6443 --token lasfnx.fppsi34dk6iu6hdd --discovery-token-ca-cert-hash sha256:079253fc46bf505da4732ef306a73c4dd0d954eff2d0ca52f3ade4f4e930a6dd
[root@node2 ~]# cp -r /etc/kubernetes /etc/kubernetes-bak
[root@node2 ~]# rm -rf /etc/kubernetes/*.conf
[root@node2 ~]# rm -rf /etc/kubernetes/pki/ca.crt
# 将Node添加到集群里;
[root@node2 ~]# kubeadm join 192.168.0.20:6443 --token lasfnx.fppsi34dk6iu6hdd --discovery-token-ca-cert-hash sha256:079253fc46bf505da4732ef306a73c4dd0d954eff2d0ca52f3ade4f
[root@master ~]# kubectl get nodes
更多推荐
已为社区贡献1条内容
所有评论(0)