root@k8s-master01 \~\]# sudo 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'
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
certificate embedded in the kubeconfig file for the super-admin 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.
\[root@k8s-master01 \~\]#
好的,根据提示,你已经成功更新了证书,接下来你需要重启相关的控制平面组件,以便它们加载并使用新的证书。这些组件通常作为静态 Pod (static pods) 运行在你的主节点上,由 `kubelet`直接管理。
**接下来的操作步骤:**
1. **重启 `kubelet` 服务:**
在你的主节点 (`k8s-master01`) 上,执行以下命令来重启 `kubelet` 服务。重启 `kubelet` 会使其重新启动由它管理的静态 Pod(包括 `kube-apiserver`, `kube-controller-manager`, `kube-scheduler` 和 `etcd`)。
```bash
sudo systemctl restart kubelet
```
* **如果你有多个主节点 (HA 集群):** 你需要在**每一个主节点** 上都执行 `sudo systemctl restart kubelet` 命令。
2. **验证组件是否已重启并正常运行:**
等待一两分钟,让组件有时间重新启动。然后进行检查:
* **检查静态 Pod 的状态:**
```bash
kubectl get pods -n kube-system
```
查看 `kube-apiserver-k8s-master01`, `kube-controller-manager-k8s-master01`, `kube-scheduler-k8s-master01` 和 `etcd-k8s-master01` (Pod 名称中的主机名部分可能与你的节点名一致) 是否处于 `Running` 状态,并注意它们的 `AGE` 是否比较新,表明它们是最近重启的。
* **检查组件日志 (可选,用于排错):**
如果某个 Pod 没有正常启动,你可以查看它的日志:
```bash
kubectl logs
k8s更新证书
ascarl20102025-06-04 12:09
相关推荐
wdxylb1 小时前
云原生俱乐部-RH134知识点总结(2)deeper_wind2 小时前
k8s-单主机Master集群部署+单个pod部署lnmp论坛服务(小白的“升级打怪”成长之路)zhenshanrenhao4 小时前
#买硬盘欲安装k8s记bing.shao5 小时前
微服务容错与监控体系设计tb_first6 小时前
k8sday09稚辉君.MCA_P8_Java7 小时前
豆包 Java的23种设计模式天上掉下来个程小白8 小时前
Docker-14.项目部署-DockerCompose星霜笔记12 小时前
Docker 部署 MariaDB+phpMyAdmin+Nextcloud 完整教程数据知道14 小时前
容器化部署:用Docker封装机器翻译模型与服务详解40kuai21 小时前
kubernetes中数据存储etcd