参考文档k8s node节点加入到集群时卡住 “[preflight] Running pre-flight checks”报错:
k8s node节点加入到集群时卡住 “[preflight] Running pre-flight checks”
搭建集群之后想把node加入到集群中,如下
[root@k8s-node1 log]# kubeadm join 10.0.0.200:6443 --token dmsehb.dvofkx1z5dpc0r58 --discovery-token-ca-cert-hash sha256:f8d6e3c1562adcd5e35d6246679c23759124229bf36e100cbf03398849263911
[preflight] Running pre-flight checks
原因
#查看master节点,发现时间不同步
[root@k8s-master1 kubeadm]# date
Sun Mar 20 04:05:57 CST 2022
[root@k8s-node1 log]# date
Mon Mar 21 17:35:48 CST 2022
解决:
#1、同步时间
[root@k8s-master1 kubeadm]# yum install ntpdate
[root@k8s-master1 kubeadm]# ntpdate ntp1.aliyun.com;hwclock --systohc
date;hwclock
#2、去mater节点重新生成token,需要获取新的token
[root@k8s-master1 kubeadm]# kubeadm token create --ttl 0 --print-join-command
kubeadm join 10.0.0.200:6443 --token dmsehb.dvofkx1z5dpc0r58 --discovery-token-ca-cert-hash sha256:f8d6e3c1562adcd5e35d6246679c23759124229bf36e100cbf03398849263911
#3、再次加入集群
[root@k8s-node2 ~]# kubeadm join 10.0.0.200:6443 --token dmsehb.dvofkx1z5dpc0r58 --discovery-token-ca-cert-hash sha256:f8d6e3c1562adcd5e35d6246679c23759124229bf36e100cbf03398849263911
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
[root@k8s-node2 ~]#
总结:
当node节点加入集群时卡在[preflight] Running pre-flight checks,有两种原因
- 集群节点之前时间不同步
- token过期,重新生成一下
所有评论(0)