K8S显示报错Initial timeout of 40s passed

报错 

[init] Using Kubernetes version: v1.23.0
[preflight] Running pre-flight checks
    [WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service'
    [WARNING Swap]: swap is enabled; production deployments should disable swap unless testing the NodeSwap feature gate of the kubelet
error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR Port-6443]: Port 6443 is in use
    [ERROR Port-10259]: Port 10259 is in use
    [ERROR Port-10257]: Port 10257 is in use
    [ERROR Port-10250]: Port 10250 is in use
    [ERROR Port-2379]: Port 2379 is in use
    [ERROR Port-2380]: Port 2380 is in use
    [ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

方法

kubeadm reset 

[root@k8s-master ~]# rm -rf /etc/kubernetes/*    # 清除文件
[root@k8s-master ~]# rm -rf ~/.kube/*
[root@k8s-master ~]# rm -rf /var/lib/etcd/*
 
 
[root@k8s-master ~]# lsof -i :6443|grep -v "PID"|awk '{print "kill -9",$2}'|sh  
[root@k8s-master ~]# lsof -i :10259|grep -v "PID"|awk '{print "kill -9",$2}'|sh
[root@k8s-master ~]# lsof -i :10257|grep -v "PID"|awk '{print "kill -9",$2}'|sh
[root@k8s-master ~]# lsof -i :10250|grep -v "PID"|awk '{print "kill -9",$2}'|sh
[root@k8s-master ~]# lsof -i :2379|grep -v "PID"|awk '{print "kill -9",$2}'|sh
[root@k8s-master ~]# lsof -i :2380|grep -v "PID"|awk '{print "kill -9",$2}'|sh
 

你可能感兴趣的:(K8S,数据结构)