k8s创建server报错-x509: certificate has expired or is not yet valid

前提:k8s证书都是正常的没有过期,前段时间做过处理。
原因:替换了k8s证书后没有对kube-apiserver主键重启,还使用的是缓存信息,重启一下问题解决
systemctl restart kube-apiserver.service
 

问题:kubectl create -f apply-server.yaml
Error from server: error when creating "ld-manage-ui-service.yaml": Get https://192.168.1.5:6443/api/v1/namespaces/chinapopin-system-test/resourcequotas: x509: certificate has expired or is not yet valid

查看apiserver日志报错,如下:
[root@master242 ld-manage-ui]# systemctl status kube-apiserver.service
● kube-apiserver.service - Kubernetes API Service
Loaded: loaded (/etc/systemd/system/kube-apiserver.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2021-06-03 09:38:55 CST; 1 years 0 months ago
Docs: https://github.com/GoogleCloudPlatform/kubernetes
Main PID: 8236 (kube-apiserver)
Tasks: 20
Memory: 551.3M
CGroup: /system.slice/kube-apiserver.service
└─8236 /usr/local/bin/kube-apiserver --logtostderr=true --v=0 --etcd-servers=https://192.168.1.5:2379,https://192.168.1.6:2379,https://192.168.1.7:2379 --advertise-address=192.168.1...
Jun 14 16:04:21 master242 kube-apiserver[8236]: E0614 16:04:21.006139 8236 available_controller.go:231] v1beta1.extensions failed with: Put https://192.168.1.5:6443/apis/apiregistration...not yet valid
Jun 14 16:04:21 master242 kube-apiserver[8236]: I0614 16:04:21.006162 8236 logs.go:41] http: TLS handshake error from 192.168.1.5:54168: remote error: tls: bad certificate
Jun 14 16:04:21 master242 kube-apiserver[8236]: I0614 16:04:21.944058 8236 logs.go:41] http: TLS handshake error from 192.168.1.5:54180: remote error: tls: bad certificate
Jun 14 16:04:21 master242 kube-apiserver[8236]: E0614 16:04:21.944099 8236 reflector.go:201] k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/factory.go:72: Failed to list *ex...
Jun 14 16:04:22 master242 kube-apiserver[8236]: I0614 16:04:22.949660 8236 logs.go:41] http: TLS handshake error from 192.168.1.5:54192: remote error: tls: bad certificate
Jun 14 16:04:22 master242 kube-apiserver[8236]: E0614 16:04:22.949696 8236 reflector.go:201] k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/factory.go:72: Failed to list *ex...
Jun 14 16:04:23 master242 kube-apiserver[8236]: I0614 16:04:23.955399 8236 logs.go:41] http: TLS handshake error from 192.168.1.5:54240: remote error: tls: bad certificate
Jun 14 16:04:23 master242 kube-apiserver[8236]: E0614 16:04:23.955470 8236 reflector.go:201] k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/factory.go:72: Failed to list *ex...
Jun 14 16:04:24 master242 kube-apiserver[8236]: I0614 16:04:24.960801 8236 logs.go:41] http: TLS handshake error from 192.168.1.5:54254: remote error: tls: bad certificate
Jun 14 16:04:24 master242 kube-apiserver[8236]: E0614 16:04:24.960856 8236 reflector.go:201] k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/factory.go:72: Failed to list *ex...

posted @ 2022-06-14 16:24  苍茫宇宙  阅读(1212)  评论(0编辑  收藏  举报