k3s 证书过期修改


作者:SRE运维博客
博客地址:https://www.cnsre.cn/
文章地址:https://www.cnsre.cn/posts/221207116004/
相关话题:https://www.cnsre.cn/tags/k3s/


去年双十一买的服务器,但是创建了 K3S 集群。今天登录的时候发现出现了以下错误。简单记录下。

故障现象

登录服务器执行相关命令出现以下错误

[root@k3s-master ~]# kubectl get  pods
error: You must be logged in to the server (Unauthorized)

执行 doker 命令判断大概问题

[root@k3s-master ~]#  docker run -it ubuntu  /bin/echo "cnsre"
cnsre

docker 命令可以执行那大概率应该是 k3s 的问题,查看 k3s 服务日志

[root@k3s-master ~]# journalctl -r -u k3s
1466 authentication.go:63] "Unable to authenticate the request" err="[x509: certificate has expired or is not yet valid: current time

发现有以上错误,那确定是证书的问题了。

解决方法

对于K3S 来说解决证书的问题其实很简单。
可以通过重启K3S 服务的来解决问题

sudo systemctl restart k3s

验证

执行命令验证问题

[root@k3s-master ~]# kubectl get  node
NAME         STATUS     ROLES                  AGE    VERSION
k3s-node1    Ready      <none>                 370d   v1.21.5+k3s2
k3s-node2    Ready      <none>                 370d   v1.21.5+k3s2
k3s-node3    Ready      <none>                 370d   v1.21.5+k3s2
k3s-master   Ready      control-plane,master   370d   v1.21.5+k3s2

问题解决。


作者:SRE运维博客
博客地址:https://www.cnsre.cn/
文章地址:https://www.cnsre.cn/posts/221207116004/
相关话题:https://www.cnsre.cn/tags/k3s/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值