containerd: [ERROR CRI]: container runtime is not running: output

Description

Hi, I have installed Docker version 20 and Kubernetes on ubuntu 22.4, when I try to do a Kubeadm init

I get

salam@kubernetes:~$ sudo kubeadm init [init] Using Kubernetes version: v1.26.1 [preflight] Running pre-flight checks error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR CRI]: container runtime is not running: output: time=“2023-02-20T08:33:48Z” 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

I do sudo systemctl status containerd

it is up and running as follows

image

not sure what I should do or check Thanks for your help

Steps to reproduce the issue

  1. Install Docker version 20.10.12, build 20.10.12-0ubuntu4
  2. Install Kubernetes components through its rep Kubeam, kubelet,…
  3. run kubeadm init

Describe the results you received and expected

[init] Using Kubernetes version: v1.26.1 [preflight] Running pre-flight checks error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR CRI]: container runtime is not running: output: time=“2023-02-20T08:40:14Z” 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

What version of containerd are you using?

containerd github.com/containerd/containerd 1.5.9-0ubuntu3.1

Any other relevant information

crictl info

salam@kubernetes:~$ crictl info WARN[0000] runtime connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead. E0220 08:42:53.348417 2971 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/dockershim.sock: connect: no such file or directory"” FATA[0000] getting status of runtime: rpc error: code = Unavailable desc = connection error: desc = “transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory”

Show configuration if it is related to CRI plugin.

cat: /etc/containerd/config.toml: No such file or directory

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 4
  • Comments: 32 (4 by maintainers)

Most upvoted comments

I had a same error while executing command kubeadm init --pod-network-cidr=10.244.0.0/16 .

Error :

root@ubuntu:/home/ahens# kubeadm init
W0331 08:19:51.766302    4689 version.go:104] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.txt": Get "https://storage.googleapis.com/kubernetes-release/release/stable-1.txt": dial tcp: lookup storage.googleapis.com on 127.0.0.53:53: server misbehaving
W0331 08:19:51.766302    4689 version.go:105] falling back to the local client version: v1.26.3
[init] Using Kubernetes version: v1.26.3
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR CRI]: container runtime is not running: output: time="2023-03-31T08:19:52Z" 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
root@ubuntu:/home/ahens#

I performed below steps :

  1. Correct configuration is specified for the endpoint “unix:///var/run/containerd/containerd.sock” and enabled the plugin instead of disabled. Added below code in /etc/containerd/config.toml [plugins.“io.containerd.grpc.v1.cri”.containerd] endpoint = “unix:///var/run/containerd/containerd.sock”

  2. systemctl restart containerd

My /etc/containerd/config.toml file :

root@ubuntu:/etc# cat /etc/containerd/config.toml
#   Copyright 2018-2022 Docker Inc.

#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at

#       http://www.apache.org/licenses/LICENSE-2.0

#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

enabled_plugins = ["cri"]
[plugins."io.containerd.grpc.v1.cri".containerd]
  endpoint = "unix:///var/run/containerd/containerd.sock"


#root = "/var/lib/containerd"
#state = "/run/containerd"
#subreaper = true
#oom_score = 0

#[grpc]
#  address = "/run/containerd/containerd.sock"
#  uid = 0
#  gid = 0

#[debug]
#  address = "/run/containerd/debug.sock"
#  uid = 0
#  gid = 0
#  level = "info"
root@ubuntu:/etc#

This resolved my issue.

Same. Are there any updates on this?

please go to /etc/containerd/config.toml change disabled_plugin to enabled_plugin

mv /etc/containerd/config.toml /root/config.toml.bak
systemctl restart containerd

Fix the Error To fix the error you can delete the config.tomal file and restart containerd then try the init command like below:

$ rm /etc/containerd/config.toml $ systemctl restart containerd $ kubeadm init

https://k21academy.com/docker-kubernetes/container-runtime-is-not-running/

Note:100% it worked for me

I resolved my issue with the commands below:

Configure containerd

mkdir -p /etc/containerd containerd config default | tee /etc/containerd/config.toml sudo sed -i ‘s/SystemdCgroup = true/SystemdCgroup = false/g’ /etc/containerd/config.toml

Restart containerd

systemctl restart containerd

Hi all i tried to enable plugin in config.toml file and i was able to initialize kubeadm

I got it, you introduced the containerd by installing docker, so the cri plug-in will not be enabled, so crictl cannot be used normally, and secondly, the containerd /etc/containerd/config.toml used by docker should be like this

#   Copyright 2018-2020 Docker Inc.

#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at

#       http://www.apache.org/licenses/LICENSE-2.0

#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

disabled_plugins = ["cri"]

#root = "/var/lib/containerd"
#state = "/run/containerd"
#subreaper = true
#oom_score = 0

#[grpc]
#  address = "/run/containerd/containerd.sock"
#  uid = 0
#  gid = 0

#[debug]
#  address = "/run/containerd/debug.sock"
#  uid = 0
#  gid = 0
#  level = "info"

Then systemctl restart containerd You try to start a nginx using docker run to see if it can be used normally.

Also, when issue

sudo cat /etc/containerd/config.toml

I get

cat: /etc/containerd/config.toml: No such file or directory

you need to install containerd and then try to find this config file. Once found, edit and enable CRI plugin which is by default disabled_plugin. make it enabled_plugin.

After googling and updating several config files especailly with cgroup driver systemd, now I discovered that kubelet service is not starting

image

and here is the config file

1/root 2/version 3/cri I did but still getting the same error: image image

So there are a number of issues in this issue…

When trying to connect to containerd via the cri api:

  1. you can’t be using the version of the config that docker installs with cri disabled. You can enable the cri config, switch to the default config by deleting it, copy over the default config etc…
  2. certain versions of crictl/kubelet (kubernetes) require certain versions of the CRI api… if you don’t have a match for api versions you’ll get the unimplemented error
  • if you are running a 1.5 version of containerd it does not have the v1 CRI api… thus you won’t be able to connect to a version of crictl/kubelet that requires the v1 CRI api, version 1.5 of CRI only has the v1alpha2 CRI api and version 1.26 and up of kubernetes only support v1 CRI;
  • version 1.6 and 1.7 of containerd have both v1alpha2 and v1 CRI apis so these versions of containerd should work with pretty much any version of kubernetes currently in support
  • check the version of containerd and the version of kubelet/crictl that you are using and make sure they match up here’s the table explaining this https://github.com/containerd/containerd/blob/main/RELEASES.md#kubernetes-support
  • When running off the current main branch of containerd (soon to be the v2 version) only the v1 CRI api is included so you’ll need to be on a v1.24 or later version of crictl/kubelet(kubernetes)
  1. you need to be running as root when connecting to a version of containerd that is running as root… otherwise you’ll get the connection refused error

apologies for any confusion, please reopen or comment if these resolutions do not fix you problem…

OK, I created manually the file

/etc/crictl.yaml

and pasted

runtime-endpoint: “unix:///run/containerd/containerd.sock” timeout: 0 debug: false

running sudo crictl ps I get

FATA[0000] validate service connection: CRI v1 runtime API is not implemented for endpoint “unix:///run/containerd/containerd.sock”: rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService

rerun

E0220 09:58:16.039139 4374 remote_runtime.go:390] “ListContainers with filter from runtime service failed” err=“rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /run/containerd/containerd.sock: connect: permission denied"” filter=“&ContainerFilter{Id:,State:&ContainerStateValue{State:CONTAINER_RUNNING,},PodSandboxId:,LabelSelector:map[string]string{},}” FATA[0000] listing containers: rpc error: code = Unavailable desc = connection error: desc = “transport: Error while dialing dial unix /run/containerd/containerd.sock: connect: permission denied” salam@kubernetes:/$ sudo crictl ps FATA[0000] validate service connection: CRI v1 runtime API is not implemented for endpoint “unix:///run/containerd/containerd.sock”: rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService