When I drain and remove existing work node in cluster, if I want to rejoin it to master, it report a error under below.
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
[ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists
It is happening because you've already executed join command on your node once. That's why the files are still there.
If your node hasn't been deleted from the cluster(just drained only), you don't have to run kubeadm join. You can rejoin the node by running the command-
kubectl uncordon NODENAME
Else, to get rid of this error, try running the following command on your node to purge these files-
kubeadm reset
If the reset command fails, try forcing the reset process by running-
kubeadm reset --force
Now try to execute the join command again.