kubeadm进行kubernetes证书管理

检查证书是否过期

kubeadm certs check-expiration

[check-expiration] Reading configuration from the cluster...
[check-expiration] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'

CERTIFICATE                EXPIRES                  RESIDUAL TIME   CERTIFICATE AUTHORITY   EXTERNALLY MANAGED
admin.conf                 Mar 15, 2023 01:59 UTC   362d            ca                      no      
apiserver                  Mar 15, 2023 01:58 UTC   362d            ca                      no      
apiserver-etcd-client      Mar 15, 2023 01:59 UTC   362d            etcd-ca                 no      
apiserver-kubelet-client   Mar 15, 2023 01:59 UTC   362d            ca                      no      
controller-manager.conf    Mar 15, 2023 01:59 UTC   362d            ca                      no      
etcd-healthcheck-client    Mar 15, 2023 01:59 UTC   362d            etcd-ca                 no      
etcd-peer                  Mar 15, 2023 01:59 UTC   362d            etcd-ca                 no      
etcd-server                Mar 15, 2023 01:59 UTC   362d            etcd-ca                 no      
front-proxy-client         Mar 15, 2023 01:59 UTC   362d            front-proxy-ca          no      
scheduler.conf             Mar 15, 2023 01:59 UTC   362d            ca                      no      

CERTIFICATE AUTHORITY   EXPIRES                  RESIDUAL TIME   EXTERNALLY MANAGED
ca                      Mar 12, 2032 01:58 UTC   9y              no      
etcd-ca                 Mar 12, 2032 01:59 UTC   9y              no      
front-proxy-ca          Mar 12, 2032 01:59 UTC   9y              no

手动更新证书

kubeadm certs renew -h

This command is not meant to be run on its own. See list of available subcommands.

Usage:
  kubeadm certs renew [flags]
  kubeadm certs renew [command]

Available Commands:
  admin.conf               Renew the certificate embedded in the kubeconfig file for the admin to use and for kubeadm itself
  all                      Renew all available certificates
  apiserver                Renew the certificate for serving the Kubernetes API
  apiserver-etcd-client    Renew the certificate the apiserver uses to access etcd
  apiserver-kubelet-client Renew the certificate for the API server to connect to kubelet
  controller-manager.conf  Renew the certificate embedded in the kubeconfig file for the controller manager to use
  etcd-healthcheck-client  Renew the certificate for liveness probes to healthcheck etcd
  etcd-peer                Renew the certificate for etcd nodes to communicate with each other
  etcd-server              Renew the certificate for serving etcd
  front-proxy-client       Renew the certificate for the front proxy client
  scheduler.conf           Renew the certificate embedded in the kubeconfig file for the scheduler manager to use

Flags:
  -h, --help   help for renew

Global Flags:
      --add-dir-header           If true, adds the file directory to the header of the log messages
      --log-file string          If non-empty, use this log file
      --log-file-max-size uint   Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
      --one-output               If true, only write logs to their native severity level (vs also writing to each lower severity level)
      --rootfs string            [EXPERIMENTAL] The path to the 'real' host root filesystem.
      --skip-headers             If true, avoid header prefixes in the log messages
      --skip-log-headers         If true, avoid headers when opening log files
  -v, --v Level                  number for the log level verbosity
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

Done renewing certificates. You must restart the kube-apiserver, kube-controller-manager, kube-scheduler and etcd, so that they can use the new certificates.
kubeadm certs check-expiration

CERTIFICATE                EXPIRES                  RESIDUAL TIME   CERTIFICATE AUTHORITY   EXTERNALLY MANAGED
admin.conf                 Mar 17, 2023 05:38 UTC   364d            ca                      no      
apiserver                  Mar 17, 2023 05:38 UTC   364d            ca                      no      
apiserver-etcd-client      Mar 17, 2023 05:38 UTC   364d            etcd-ca                 no      
apiserver-kubelet-client   Mar 17, 2023 05:38 UTC   364d            ca                      no      
controller-manager.conf    Mar 17, 2023 05:38 UTC   364d            ca                      no      
etcd-healthcheck-client    Mar 17, 2023 05:38 UTC   364d            etcd-ca                 no      
etcd-peer                  Mar 17, 2023 05:38 UTC   364d            etcd-ca                 no      
etcd-server                Mar 17, 2023 05:38 UTC   364d            etcd-ca                 no      
front-proxy-client         Mar 17, 2023 05:38 UTC   364d            front-proxy-ca          no      
scheduler.conf             Mar 17, 2023 05:38 UTC   364d            ca                      no      

CERTIFICATE AUTHORITY   EXPIRES                  RESIDUAL TIME   EXTERNALLY MANAGED
ca                      Mar 12, 2032 01:58 UTC   9y              no      
etcd-ca                 Mar 12, 2032 01:59 UTC   9y              no      
front-proxy-ca          Mar 12, 2032 01:59 UTC   9y              no    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值