在使用 kubespray 将 Kubernetes 从 1.14 升级到 1.15 期间,我的团队在“升级第一个主服务器”步骤中遇到了以下消息的阻塞问题:
[upgrade/apply] FATAL: couldn''t upgrade control plane.
kubeadm has tried to recover everything into the earlier state.
Errors faced: [failed to renew certificates for component "kube-apiserver":
failed to renew certificate apiserver-kubelet-client:
unable to sign certificate:
must specify at least one ExtKeyUsage,
rename /etc/kubernetes/tmp/kubeadm
-backup-manifests-2019-09-19-09-06-27/kube-apiserver.yaml /etc/kubernetes/manifests/kube-apiserver.yaml: no such file or directory]'
尝试隔离任务并手动运行 kubeadm 命令行会导致相同的错误消息:
#/usr/local/bin/kubeadm upgrade apply -y v1.15.3 --config=/etc/kubernetes/kubeadm-config.yaml --ignore-preflight-errors=all --allow-experimental-upgrades --allow-release-candidate-upgrades --etcd-upgrade=false -v 6
甚至尝试手动更新证书:
/etc/kubernetes/pki# kubeadm alpha certs renew apiserver-kubelet-client -v 9
I0919 14:42:11.515503 18597 initconfiguration.go:105] detected and using CRI socket: /var/run/dockershim.sock
I0919 14:42:11.515897 18597 interface.go:384] Looking for default routes with IPv4 addresses
I0919 14:42:11.515916 18597 interface.go:389] Default route transits interface “eth0”
I0919 14:42:11.516284 18597 interface.go:196] Interface eth0 is up
(...)
I0919 14:42:11.516835 18597 feature_gate.go:216] feature gates: &{map[]}
failed to renew certificate apiserver-kubelet-client: unable to sign certificate: must specify at least one ExtKeyUsage
最终找到了解决方案并发布在下面。