前言:

kubernetes的部署从1.24版本开始后,弃用docker-shim,也就是说部署1.24版本后的集群不能使用docker-ce了。

比较清晰的解决方案有两个,一是使用containerd,这个是一个新的支持cri标准的shim,一个是使用cri-docker这样的中间插件形式,一头通过CRI跟kubelet交互,另一头跟docker api交互,从而间接的实现了kubernetes以docker作为容器运行时。但是这种架构缺点也很明显,调用链更长,效率更低。

那么,cri-docker虽然有效率低下的缺点,但很明显这个更加符合原来的docker使用习惯。说人话就是部署简单,学习成本不会太高。

因此,如果是仅仅想测试新版本的kubernetes,体验新版本的kubernetes,无疑还是使用cri-docker更为合适的。

如果是1.24版本之后的kubelet的组件启动时报这个错。就类似于1.24版本之前的swap没关一样。把cri-docker启动就行了,因为kube-apiserver要通过这个cri和docker的api进行交互。

 

 

Jan 6 14:27:38 k8s-node01 systemd: kubelet.service: main process exited, code=exited, status=1/FAILURE
Jan 6 14:27:38 k8s-node01 systemd: Unit kubelet.service entered failed state.
Jan 6 14:27:38 k8s-node01 systemd: kubelet.service failed.
Jan 6 14:27:38 k8s-node01 systemd: kubelet.service holdoff time over, scheduling restart.
Jan 6 14:27:38 k8s-node01 systemd: Stopped Kubernetes Kubelet.
Jan 6 14:27:38 k8s-node01 systemd: Started Kubernetes Kubelet.
Jan 6 14:27:38 k8s-node01 kubelet: Flag --logtostderr has been deprecated, will be removed in a future release, see https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components
Jan 6 14:27:38 k8s-node01 kubelet: Flag --log-dir has been deprecated, will be removed in a future release, see https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/2845-deprecate-klog-specific-flags-in-k8s-components
Jan 6 14:27:38 k8s-node01 kubelet: E0106 14:27:38.763461 29713 run.go:74] "command failed" err="failed to run Kubelet: unable to determine runtime API version: 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\""
Jan 6 14:27:38 k8s-node01 systemd: kubelet.service: main process exited, code=exited, status=1/FAILURE
Jan 6 14:27:38 k8s-node01 systemd: Unit kubelet.service entered failed state.
Jan 6 14:27:38 k8s-node01 systemd: kubelet.service failed.
Jan 6 14:27:38 k8s-node01 systemd: kubelet.service holdoff time over, scheduling restart.
Jan 6 14:27:38 k8s-node01 systemd: Stopped Kubernetes Kubelet.
Jan 6 14:27:38 k8s-node01 systemd: start request repeated too quickly for kubelet.service
Jan 6 14:27:38 k8s-node01 systemd: Failed to start Kubernetes Kubelet.
Jan 6 14:27:38 k8s-node01 systemd: Unit kubelet.service entered failed state.
Jan 6 14:27:38 k8s-node01 systemd: kubelet.service failed.

 

 

解决办法:

   systemctl start cri-docker