k8s入门k8s那点事儿

kubeadm初始化 apiserver证书到期替换.md

2019-08-09  本文已影响0人  平凡的运维之路

Kubernetes证书到期导致解决方法

openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text  |grep Not

[root@master ~]# openssl x509 -in /etc/kubernetes/pki/ca.crt -noout -text  |grep Not

具体解决方法

mkdir -p  /root/`date +%F`;cp –ar /etc/kubernetes /root/`date +%F`

tar zxf kubeadm.tgz

./kubeadm alpha certs renew all

systemctl restart kubelet

mv ~/.kube/config ~/.kube/config_`date +%F`
cp /etc/kubernetes/admin.conf ~/.kube/config

[root@master ~]# openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text  |grep Not
            Not Before: May 25 06:57:29 2019 GMT
            Not After : Jul 14 02:51:55 2119 GMT

[root@master ~]# openssl x509 -in /etc/kubernetes/pki/ca.crt -noout -text  |grep Not
            Not Before: May 25 06:57:29 2019 GMT
            Not After : May 22 06:57:29 2029 GMT

[root@master ~]# openssl x509 -in /etc/kubernetes/pki/etcd/ca.crt -noout -text  |grep Not
            Not Before: May 25 06:57:33 2019 GMT
            Not After : May 22 06:57:33 2029 GMT

[root@master ~]# kubectl  get pods 
NAME                      READY     STATUS    RESTARTS   AGE
myapp-7877647684-4l6gt    1/1       Running   2          37d
myapp2-79f74b4cd8-vdk7v   1/1       Running   2          37d

上一篇下一篇

猜你喜欢

热点阅读