使用 kubeadm 更换证书
1、检查证书是否过期
kubeadm certs check-expiration
2、备份集群证书、配置信息
kubeadm config view > kubeadm-cluster.yaml
cp -r /etc/kubernetes/ /etc/kubernetes_bak
3、执行更新
kubeadm certs renew all
4、重启相关应用(所有master都要执行)
docker:
docker ps |grep -E 'k8s_kube-apiserver|k8s_kube-controller-manager|k8s_kube-scheduler|k8s_etcd_etcd' | awk -F ' ' '{print $1}' |xargs docker restart
containerd则执行:
crictl ps |grep -E 'kube-apiserver|kube-controller-manager|kube-scheduler|etcd' | awk -F ' ' '{print $1}' |xargs crictl stop