参考文档:K8S部署遇到的问题处理汇总

报错输出:

[root@localhost ~]#  kubeadm join 192.168.1.11:6443 --token esce21.q6hetwm8si29qxwn     --discovery-token-ca-cert-hash sha256:5ea87ae5440baa0412acca4fa7d0c650677b37519f57765eed13b9df88c3b2be
W0609 12:12:28.090212    5700 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
^C
[root@localhost ~]# kubeadm join 192.168.1.112:6443 --token pr5ftv.ihrv3t2p32n1s2p8 \
>     --discovery-token-ca-cert-hash sha256:5ea87ae5440baa0412acca4fa7d0c650677b37519f57765eed13b9df88c3b2be 
W0609 12:15:19.889127    5785 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[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 -oyaml'
error execution phase kubelet-start: a Node with name "localhost.localdomain" and status "Ready" already exists in the cluster. You must delete the existing Node or change the name of this new joining Node
To see the stack trace of this error execute with --v=5 or higher

错误原因:
token令牌失效,从新获取token,node节点重新加入

解决方法:

#1、去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
#2、再次加入集群
[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 ~]#
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐