一、问题背景
- kubernetes 的安装方式为:kubeadm安装;
- 执行
kubectl get po
时遇到的报错如下:
E0205 13:19:46.526842 21513 memcache.go:238] couldn't get current server API group list: Get "https://cloudwave1:6443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2024-02-05T13:19:46+08:00 is after 2024-01-20T10:16:49Z E0205 13:19:46.529545 21513 memcache.go:238] couldn't get current server API group list: Get "https://cloudwave1:6443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2024-02-05T13:19:46+08:00 is after 2024-01-20T10:16:49Z E0205 13:19:46.532281 21513 memcache.go:238] couldn't get current server API group list: Get "https://cloudwave1:6443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2024-02-05T13:19:46+08:00 is after 2024-01-20T10:16:49Z E0205 13:19:46.538640 21513 memcache.go:238] couldn't get current server API group list: Get "https://cloudwave1:6443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2024-02-05T13:19:46+08:00 is after 2024-01-20T10:16:49Z E0205 13:19:46.541266 21513 memcache.go:238] couldn't get current server API group list: Get "https://cloudwave1:6443/api?timeout=32s": x509: certificate has expired or is not yet valid: current time 2024-02-05T13:19:46+08:00 is after 2024-01-20T10:16:49Z Unable to connect to the server: x509: certificate has expired or is not yet valid: current time 2024-02-05T13:19:46+08:00 is after 2024-01-20T10:16:49Z
显然,证书到期了,没有续;
二、解决办法如下
- 执行:
kubeadm certs renew all
,更新证书 - 找到并重启
kube-apiserver
服务
## 查找服务 docker ps | grep kube-api ## docker restart 容器id
- 找到并重启
kube-controller-manager
服务
## 查找服务 docker ps | grep kube-controller ## docker restart 容器id
- 找到并重启
kube-scheduler
服务
## 查找服务 docker ps | grep kube-scheduler ## docker restart 容器id
- 找到并重启
etcd
服务
## 查找服务 docker ps | grep etcd ## docker restart 容器id