Tag Archives: /etc/kubernetes/kubelet.conf already exists

k8s Error: [ERROR FileAvailable–etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists

Error log:

[preflight] Running pre-flight checks
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
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

The reason is: some configuration files and services already exist
Solution:

#reset kubeadm 
kubeadm reset

After running the kubeadm join command

or

Cause: There are residual files
Solution: (works)

#Delete k8s configuration file and certificate file
rm -rf /etc/kubernetes/kubelet.conf /etc/kubernetes/pki/ca.crt #Delete k8s configuration file and certificate file
# 
kubeadm join 192.168.191.133:6443 --token xvnp3x.pl6i8ikcdoixkaf0 \
    --discovery-token-ca-cert-hash sha256:9f90161043001c0c75fac7d61590734f844ee507526e948f3647d7b9cfc1362d