很久没用的K8S集群,API一直在重启中
#查看API的报错如下
docker ps -a|grep api
#查看日志
docker logs 3a921816f730
W1030 07:47:53.595614 1 clientconn.go:1331] [core] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 127.0.0.1
0 }. Err: connection error: desc = "transport: authentication handshake failed: x509: certificate has expired or is not yet valid: current time 2023-10-30T07:47:53Z is after 2023-03-11T08:48:10Z". Reconnecting...
#检测是否过期
kubeadm certs check-expiration
[check-expiration] Reading configuration from the cluster...
[check-expiration] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[check-expiration] Error reading configuration from the Cluster. Falling back to default configuration
CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED
admin.conf Mar 11, 2023 08:48 UTC no
apiserver Mar 11, 2023 08:48 UTC ca no
apiserver-etcd-client Mar 11, 2023 08:48 UTC etcd-ca no
apiserver-kubelet-client Mar 11, 2023 08:48 UTC ca no
controller-manager.conf Mar 11, 2023 08:48 UTC no
etcd-healthcheck-client Mar 11, 2023 08:48 UTC etcd-ca no
etcd-peer Mar 11, 2023 08:48 UTC etcd-ca no
etcd-server Mar 11, 2023 08:48 UTC etcd-ca no
front-proxy-client Mar 11, 2023 08:48 UTC front-proxy-ca no
scheduler.conf Mar 11, 2023 08:48 UTC no
CERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
ca Mar 08, 2032 08:48 UTC 8y no
etcd-ca Mar 08, 2032 08:48 UTC 8y no
front-proxy-ca Mar 08, 2032 08:48 UTC 8y no
#重启生成证书
kubeadm certs renew all
[renew] Reading configuration from the cluster...
[renew] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[renew] Error reading configuration from the Cluster. Falling back to default configuration
certificate embedded in the kubeconfig file for the admin to use and for kubeadm itself renewed
certificate for serving the Kubernetes API renewed
certificate the apiserver uses to access etcd renewed
certificate for the API server to connect to kubelet renewed
certificate embedded in the kubeconfig file for the controller manager to use renewed
certificate for liveness probes to healthcheck etcd renewed
certificate for etcd nodes to communicate with each other renewed
certificate for serving etcd renewed
certificate for the front proxy client renewed
certificate embedded in the kubeconfig file for the scheduler manager to use renewed
Done renewing certificates. You must restart the kube-apiserver, kube-controller-manager, kube-scheduler and etcd, so that they can use the new certificates.
#重新配置config
cp /etc/kubernetes/admin.conf ~/.kube/config
#重启服务就可以正常使用了
kubectl -n kube-system delete pod -l 'component=kube-apiserver'
kubectl -n kube-system delete pod -l 'component=kube-controller-manager'
kubectl -n kube-system delete pod -l 'component=kube-scheduler'
kubectl -n kube-system delete pod -l 'component=etcd'
阅读(346) | 评论(0) | 转发(0) |