目录
2、现在我们要把node02删除重新添加,先要在master节点上操作删除node02
4、再返回master节点生成token值并且输出加入集群的命令
5、复制上面命令输出的第三行在node02节点上操作加入集群
1、在master节点查看所有的node节点
[root@master ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
master Ready master 23h v1.17.4
node01 Ready <none> 23h v1.17.4
node02 NotReady <none> 23h v1.17.4
2、现在我们要把node02删除重新添加,先要在master节点上操作删除node02
[root@master ~]# kubectl delete node node02
node "node02" deleted
3、然后再node02节点上清空集群信息
[root@node02 ~]# kubeadm reset
[reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.
[reset] Are you sure you want to proceed? [y/N]: y
[preflight] Running pre-flight checks
W0104 08:34:26.074442 68854 removeetcdmember.go:79] [reset] No kubeadm config, using etcd pod spec to get data directory
[reset] No etcd config found. Assuming external etcd
[reset] Please, manually reset etcd to prevent further issues
[reset] Stopping the kubelet service
[reset] Unmounting mounted directories in "/var/lib/kubelet"
[reset] Deleting contents of config directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
[reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
[reset] Deleting contents of stateful directories: [/var/lib/kubelet /var/lib/dockershim /var/run/kubernetes /var/lib/cni]
The reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d
The reset process does not reset or clean up iptables rules or IPVS tables.
If you wish to reset iptables, you must do so manually by using the "iptables" command.
If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
to reset your system's IPVS tables.
The reset process does not clean your kubeconfig files and you must remove them manually.
Please, check the contents of the $HOME/.kube/config file.
4、再返回master节点生成token值并且输出加入集群的命令
[root@master ~]# kubeadm token create --print-join-command
W0206 11:04:15.278475 29635 validation.go:28] Cannot validate kubelet config - no validator is available
W0206 11:04:15.358432 29635 validation.go:28] Cannot validate kube-proxy config - no validator is available
kubeadm join 192.168.124.146:6443 --token beugsu.9qaksadu3lz5mo7t --discovery-token-ca-cert-hash sha256:3394bd74680568f0d97ad67b42411b7b49eb6773f19de9efcd5a0e2d92d3447f
5、复制上面命令输出的第三行在node02节点上操作加入集群
[root@node02 ~]# kubeadm join 192.168.124.146:6443 --token beugsu.9qaksadu3lz5mo7t --discovery-token-ca-cert-hash sha256:3394bd74680568f0d97ad67b42411b7b49eb6773f19de9efcd5a0e2d92d3447f
[preflight] Running pre-flight checks