K8s初始化遇到的一个错误:x509: certificate has expired or is not yet valid: current time

2021-04-30 15:45:53 浏览数 (1)

初始化过程

代码语言:javascript复制
[12:19:42root@k8s-master1 ~]#kubeadm init --config=kubeadm-config.yaml
W0429 12:19:55.473821   16375 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
[init] Using Kubernetes version: v1.19.10
[preflight] Running pre-flight checks
    [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR ExternalEtcdVersion]: Get "https://42.51.80.237:2379/version": x509: certificate has expired or is not yet valid: current time 2021-04-29T12:20:11 08:00 is before 2021-04-29T08:50:00Z
    [ERROR ExternalEtcdVersion]: Get "https://42.51.80.238:2379/version": x509: certificate has expired or is not yet valid: current time 2021-04-29T12:20:26 08:00 is before 2021-04-29T08:50:00Z
    [ERROR ExternalEtcdVersion]: Get "https://42.51.80.239:2379/version": x509: certificate has expired or is not yet valid: current time 2021-04-29T12:20:41 08:00 is before 2021-04-29T08:50:00Z
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

原因

代码语言:javascript复制
etcd我采用的是外置,发现etcd集群时间和k8s集群时间不一致导致的

同步时间

代码语言:javascript复制
timedatectl set-timezone Asia/Shanghai
chronyc -a makestep

0 人点赞