简介
本文档介绍在Cisco 5G RCM(冗余配置管理器)中续订Kubernetes证书的过程。
前提条件
如果它是RCM高可用性设置,则必须先在备用RCM上执行该过程,然后执行切换,并在新的备用RCM上运行该过程。如果没有RCM高可用性可用,UP冗余在RCM重新启动期间不可用,这是证书续订流程的一部分。
检查证书是否过期
要确保证书是否过期,请运行sudo kubeadm alpha certs check-expiration。
ubuntu@rcm:~$ sudo kubeadm alpha certs check-expiration
CERTIFICATE EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
admin.conf Oct 31, 2024 03:34 UTC <invalid> no
apiserver Oct 31, 2024 03:34 UTC <invalid> no
apiserver-etcd-client Oct 31, 2024 03:34 UTC <invalid> no
apiserver-kubelet-client Oct 31, 2024 03:34 UTC <invalid> no
controller-manager.conf Oct 31, 2024 03:34 UTC <invalid> no
etcd-healthcheck-client Oct 31, 2024 03:34 UTC <invalid> no
etcd-peer Oct 31, 2024 03:34 UTC <invalid> no
etcd-server Oct 31, 2024 03:34 UTC <invalid> no
front-proxy-client Oct 31, 2024 03:34 UTC <invalid> no
scheduler.conf Oct 31, 2024 03:34 UTC <invalid> no
更新证书
运行sudo kubeadm alpha certs renew all以更新证书。
ubuntu@rcm:~$ sudo kubeadm alpha certs renew all
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 healtcheck 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
如果证书已续订,请再次检查
运行sudo kubeadm alpha certs check-expiration以检查证书是否已续订。
ubuntu@rcm:~$ sudo kubeadm alpha certs check-expiration
CERTIFICATE EXPIRES RESIDUAL TIME EXTERNALLY MANAGED
admin.conf Nov 01, 2025 03:34 UTC 364d no
apiserver Nov 01, 2025 03:34 UTC 364d no
apiserver-etcd-client Nov 01, 2025 03:34 UTC 364d no
apiserver-kubelet-client Nov 01, 2025 03:34 UTC 364d no
controller-manager.conf Nov 01, 2025 03:34 UTC 364d no
etcd-healthcheck-client Nov 01, 2025 03:34 UTC 364d no
etcd-peer Nov 01, 2025 03:34 UTC 364d no
etcd-server Nov 01, 2025 03:34 UTC 364d no
front-proxy-client Nov 01, 2025 03:34 UTC 364d no
scheduler.conf Nov 01, 2025 03:34 UTC 364d no
修改kubelet.conf
在kubeadm版本1.17之前,需要手动修改kubelet.conf。将client-certificate-data和client-key-data替换为。
/etc/kubernetes/kubelet.conf
client-certificate:/var/lib/kubelet/pki/kubelet-client-current.pem
client-key: /var/lib/kubelet/pki/kubelet-client-current.pem
复制admin.conf
复制admin.conf以覆盖.kube/config。
sudo cp /etc/kubernetes/admin.conf ~/.kube/config
重新启动系统
sudo reboot
确保kubectl命令是否有效
重新启动后,确保kubectl命令运行正常。
ubuntu@rcm:~$ kubectl get node
NAME STATUS ROLES AGE VERSION
rcm Ready master,oam 16d v1.15.12