参考链接:云灬沙-Error execution phase kubelet-start: a Node with name ... and status Ready already exists
完整报错信息
[root@localhost ~]# kubeadm join 192.168.1.112:6443 --token kkj95v.77am3u1k3q4b4qc3 --discovery-token-ca-cert-hash sha256:5ea87ae5440baa0412acca4fa7d0c650677b37519f57765eed13b9df88c3b2be
W0609 12:30:31.021373 40835 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
使用kubeadm部署K8S的时候出现了这样的问题,因为使用的是虚拟机复制,Node是Master的复制,
kubeadm 默认使用主机名作为节点名,当您从主服务器克隆工作程序时,它们具有相同的主机名。
解决方案:
- 给node一个新的hostname通过hostnamectl或其他工具
- 在集群加入Node时使用–node-name来标识一下
例如可以先执行这一句再加入
hostnamectl set-hostname k8s-node1
记得使用
kubeadm reset