\[root@k8s-node1 ~\]# 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 W1121 05:40:44.876393 9649 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. 在集群中查看集群的token值
1 2 3
\[root@k8s-master ~\]# kubeadm token create --print-join-command W1121 05:38:27.405833 12512 configset.go:348\] WARNING: kubeadm cannot validate component configs for API groups \[kubelet.config.k8s.io kubeproxy.config.k8s.io\] kubeadm join 10.0.1.48:6443 --token 8xwcaq.qxekio9xd02ed936 --discovery-token-ca-cert-hash sha256:d988ba566675095ae25255d63b21cc4d5a9a69bee9905dc638f58b217c651c14
5. 将node节点重新添加到k8s集群中
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
\[root@k8s-node1 ~\]# kubeadm join 10.0.1.48:6443 --token 8xwcaq.qxekio9xd02ed936 --discovery-token-ca-cert-hash sha256:d988ba566675095ae25255d63b21cc4d5a9a69bee9905dc638f58b217c651c14 \[preflight\] Running pre-flight checks \[WARNING IsDockerSystemdCheck\]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ \[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' \[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-master ~\]# kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master Ready master 13d v1.19.3 k8s-node1 Ready <none> 24m v1.19.3 k8s-node2 Ready <none> 24m v1.19.3