
某一天重启 之后,发现 k8s起不来了现象如下:
kubectl get nodes
The connection to the server 10.124.200.145:442 was refused - did you specify the right host or port?
访问页面的rancher也失败了。
查阅资料发现,是证书过期了,k8s距离服务创建成功已经一年了,这上面的证书一年之后就会过期,但是我用的是rancher容器的,证书的替换跟一般的k8s不一样。更新证书,延长证书的到期时间网上教程很多。但是都很麻烦。
由于我是自己的环境,所以临时可以使用更改系统时间来恢复。
#关闭自动同步
timedatectl set-ntp false
#设置时间回到一年前的今天,方便日志文件查看啥的,就年份不一样。
sudo timedatectl set-time '2023-12-13 15:20:00'
然后再重启一下
systemctl restart kubelet 或者重启虚拟机都行 reboot
接下来发现就恢复了
systemctl status kubelet
kubelet get nodes

