Kubernetes 无法join:[ERROR CRI]: container runtime is not running:

发布时间 2023-09-30 10:08:33作者: 迷途小石头

Kubernetes初始化成功,然后将node加入,结果报错:

[root@k8s-node1 ~]# kubeadm join 10.10.10.185:6443 --token 84pas2.ifxb6o8g7h2abg28 --discovery-token-ca-cert-hash sha256:f85f0c324e0b951238617f9037832b63e4c4a6c7679aaa53c711a829fc9374e6
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
	[ERROR CRI]: container runtime is not running: output: time="2023-09-27T14:07:00+08:00" level=fatal msg="validate service connection: CRI v1 runtime API is not implemented for endpoint \"unix:///var/run/containerd/containerd.sock\": rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService"
, error: exit status 1
[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

很明显,是containerd配置问题。直接将/etc/containerd/config.toml重新配置,

containerd config default
systemctl restart containerd

然后重新加入,成功!

[root@k8s-node1 containerd]# kubeadm join 10.10.10.185:6443 --token 84pas2.ifxb6o8g7h2abg28 --discovery-token-ca-cert-hash sha256:f85f0c324e0b951238617f9037832b63e4c4a6c7679aaa53c711a829fc9374e6
[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'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
Kubernetes 无法join:[ERROR CRI]: container runtime is not running: