k8s入坑之报错(3)解决error execution phase preflight: [preflight] Some fatal errors occurred

参考链接:
K8S部署遇到的问题处理汇总
node节点加入k8s集群失败
kubeadm join 运行出错:FileAvailable--etc-kubernetes-pki-ca.crt,FileAvailable--etc-kubernetes-bootstrap-k

报错查询
error execution phase preflight: [preflight] Some fatal errors occurred
[ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists

报错日志:

[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=...`

原因是:一些配置文件与服务已经存在
解决方案:

#重置kubeadm 
kubeadm reset

在运行kubeadm join命令

或者

原因:有残留文件
解决方案:(有效)

#删除k8s配置文件和证书文件
rm -rf /etc/kubernetes/kubelet.conf /etc/kubernetes/pki/ca.crt #删除k8s配置文件和证书文件
# 
kubeadm join 192.168.191.133:6443 --token xvnp3x.pl6i8ikcdoixkaf0 \
    --discovery-token-ca-cert-hash sha256:9f90161043001c0c75fac7d61590734f844ee507526e948f3647d7b9cfc1362d
posted @ 2022-06-14 22:44  muzlei  阅读(3955)  评论(0编辑  收藏  举报