K8S集群node的删除和添加
copy自: K8S集群node的删除和添加
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
[root@master ~]# kubectl delete node node02
node "node02" deleted
[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.
[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
[root@node02 ~]# kubeadm join 192.168.124.146:6443 --token beugsu.9qaksadu3lz5mo7t --discovery-token-ca-cert-hash sha256:3394bd74680568f0d97ad67b42411b7b49eb6773f19de9efcd5a0e2d92d3447f
[preflight] Running pre-flight checks