一、初始化k8s集群报无法找到/var/run/cri-dockerd.sock
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: E1122 17:34:04.346039 2127 remote_runtime.go:616] "Status from runtime service failed" err="rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/cri-dockerd.sock: connect: no such file or directory\""
time="2023-11-22T17:34:04+08:00" level=fatal msg="getting status of runtime: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/cri-dockerd.sock: connect: no such file or directory\""
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
解决方法:
1)查看Cri-DockerD是否安装
[root@localhost ~]# rpm -qa |grep cri-dockerd
2)查看Docker和Cri-Docker是否启动
[root@localhost ~]# systemctl status docker && systemctl status cri-docker
二、初始化集群报发现两个CRI,默认CRI是Containerd
Found multiple CRI endpoints on the host. Please define which one do you wish to use by setting the 'criSocket' field in the kubeadm configuration file: unix:///var/run/containerd/containerd.sock, unix:///var/run/cri-dockerd.sock
To see the stack trace of this error execute with --v=5 or higher
解决方法:
[root@localhost ~]# kubeadm init --apiserver-advertise-address=1.1.1.1 --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr=192.168.0.0/16
--cri-socket=unix:///var/run/cri-dockerd.sock
或者
[root@localhost ~]# kubeadm init --apiserver-advertise-address=1.1.1.1 --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr=192.168.0.0/16
--cri-socket= unix:///var/run/containerd/containerd.sock
三、加入集群报节点名称重复
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
error execution phase kubelet-start: a Node with name "k8s-node1" and status "Ready" already exists in the cluster. You must delete the existing Node or change the name of this new joining Node
To see the stack trace of this error execute with --v=5 or higher
解决方法:
1)修改主机名
[root@localhost ~]# hostnamectl set-hostname k8s-node2
2)重新加入集群
[root@localhost ~]# kubeadm join 192.168.2.195:6443 --token d9pz15.2dm1dpljnqjhayo1 --discovery-token-ca-cert-hash sha256:d8cd1f77da519dd2e03f126098169311389e6eba8bb31a266e6c7feb0ced0699 --cri-socket unix:///var/run/cri-dockerd.sock
四、重置集群报多个CRI
Found multiple CRI endpoints on the host. Please define which one do you wish to use by setting the 'criSocket' field in the kubeadm configuration file: unix:///var/run/containerd/containerd.sock, unix:///var/run/cri-dockerd.sock
To see the stack trace of this error execute with --v=5 or higher
解决方法:
[root@k8s-node2 ~]# kubeadm reset -f --cri-socket unix:///var/run/cri-dockerd.sock
五、加入集群报端口10250被占用
[root@k8s-master4 ~]# kubeadm join 192.168.2.195:6443 --token o6nde3.u9s7yqh8m7bke977 --discovery-token-ca-cert-hash sha256:d56e2a2d7eec8f47a66bc7c6ea4600acc8103c004f26b60ed1af44e2516322e5 --control-plane --cri-socket unix:///var/run/cri-dockerd.sock
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR Port-10250]: Port 10250 is in use
[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
解决方法:
[root@k8s-master4 ~]# kubeadm reset -f --cri-socket unix:///var/run/cri-dockerd.sock
[root@k8s-master4 ~]# kubeadm join 192.168.2.195:6443 --token o6nde3.u9s7yqh8m7bke977 --discovery-token-ca-cert-hash sha256:d56e2a2d7eec8f47a66bc7c6ea4600acc8103c004f26b60ed1af44e2516322e5 --control-plane --cri-socket unix:///var/run/cri-dockerd.sock
若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如本文“对您有用”,欢迎随意打赏,谢谢!
评论