https://github.com/kubesphere/kubekey/blob/master/docs/check-renew-certificate.md
查询证书
[root@master ~]# ls -ltotal 9770232-rw-------. 1 root root 1405 Jul 8 2021 anaconda-ks.cfg-rw-r--r-- 1 root root 10026 Jun 9 16:30 cluster-configuration.yaml-rw-r--r-- 1 root root 4748 Jun 6 16:50 config-sample.yaml-rw-r--r--. 1 root root 1269 Jun 6 11:06 config-sample.yaml.badrwxrwxr-x 10 root root 244 Jun 17 15:30 kubegems-1.21.0-rw-r--r-- 1 root root 1208820 Jun 23 13:45 kubegems-1.21.0.tar.gzdrwxr-xr-x. 13 root root 166 Jun 6 11:42 kubekey-rw-r--r--. 1 root root 17716475 Jun 6 10:50 kubekey-v2.1.1-linux-64bit.rpm-rw-r--r--. 1 root root 9985745698 Dec 17 2021 kubesphere-all-v3.1.0-offline-linux-amd64.tar.gz-rw-r--r-- 1 root root 4555 Jun 9 16:30 kubesphere-installer.yaml[root@master ~]# kk certs check-expiration_ __ _ _ __| | / / | | | | / /| |/ / _ _| |__ ___| |/ / ___ _ _| \| | | | '_ \ / _ \ \ / _ \ | | || |\ \ |_| | |_) | __/ |\ \ __/ |_| |\_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |__/ ||___/14:03:57 CST [GreetingsModule] Greetings14:03:58 CST message: [master]Greetings, KubeKey!14:03:58 CST success: [master]14:03:58 CST [CheckCertsModule] Check cluster certs14:04:00 CST success: [master]14:04:00 CST [PrintClusterCertsModule] Display cluster certs formCERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY NODEapiserver.crt Jun 06, 2023 03:42 UTC 298d ca masterapiserver-kubelet-client.crt Jun 06, 2023 03:42 UTC 298d ca masterfront-proxy-client.crt Jun 06, 2023 03:42 UTC 298d front-proxy-ca masteradmin.conf Jun 06, 2023 03:42 UTC 298d mastercontroller-manager.conf Jun 06, 2023 03:42 UTC 298d masterscheduler.conf Jun 06, 2023 03:42 UTC 298d masterCERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME NODEca.crt Jun 03, 2032 03:42 UTC 9y masterfront-proxy-ca.crt Jun 03, 2032 03:42 UTC 9y master14:04:00 CST success: [LocalHost]14:04:00 CST Pipeline[CheckCertsPipeline] execute successful
更新证书
[root@master ~]# kk certs renew_ __ _ _ __| | / / | | | | / /| |/ / _ _| |__ ___| |/ / ___ _ _| \| | | | '_ \ / _ \ \ / _ \ | | || |\ \ |_| | |_) | __/ |\ \ __/ |_| |\_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |__/ ||___/14:04:11 CST [GreetingsModule] Greetings14:04:11 CST message: [master]Greetings, KubeKey!14:04:11 CST success: [master]14:04:11 CST [RenewCertsModule] Renew control-plane certs14:04:12 CST stdout: [master]v1.21.514:04:17 CST success: [master]14:04:17 CST [RenewCertsModule] Copy admin.conf to ~/.kube/config14:04:21 CST success: [master]14:04:21 CST [RenewCertsModule] Fetch kube config file from control-plane14:04:22 CST success: [master]14:04:22 CST [RenewCertsModule] Synchronize kube config to worker14:04:22 CST skipped: [master]14:04:22 CST [CheckCertsModule] Check cluster certs14:04:25 CST success: [master]14:04:25 CST [PrintClusterCertsModule] Display cluster certs formCERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY NODEapiserver.crt Aug 11, 2023 06:04 UTC 364d ca masterapiserver-kubelet-client.crt Aug 11, 2023 06:04 UTC 364d ca masterfront-proxy-client.crt Aug 11, 2023 06:04 UTC 364d front-proxy-ca masteradmin.conf Aug 11, 2023 06:04 UTC 364d mastercontroller-manager.conf Aug 11, 2023 06:04 UTC 364d masterscheduler.conf Aug 11, 2023 06:04 UTC 364d masterCERTIFICATE AUTHORITY EXPIRES RESIDUAL TIME NODEca.crt Jun 03, 2032 03:42 UTC 9y masterfront-proxy-ca.crt Jun 03, 2032 03:42 UTC 9y master14:04:25 CST success: [LocalHost]14:04:25 CST Pipeline[RenewCertsPipeline] execute successful[root@master ~]#
自动更换证书
[root@master ~]# find / admin.conf |grep admin.conf/etc/kubernetes/admin.conf/root/kubekey/master/admin.conf/tmp/kubekey/admin.conffind: ‘admin.conf’: No such file or directory[root@master ~]#[root@master ~]# ls -l /etc/kubernetes/admin.conf-rw-------. 1 kube root 5611 Aug 11 14:04 /etc/kubernetes/admin.conf[root@master ~]# ls -l /root/kubekey/master/admin.conf-rw-r--r-- 1 root root 5611 Aug 11 14:04 /root/kubekey/master/admin.conf[root@master ~]# ls -l /root/kubekey/master/admin.conf-rw-r--r-- 1 root root 5611 Aug 11 14:04 /root/kubekey/master/admin.conf[root@master ~]# ls -l /root/.kube/config-rw-------. 1 root root 5611 Aug 11 14:04 /root/.kube/config[root@master ~]#
