<p><a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-config/#cmd-config-images-pull" rel="nofollow noreferrer">In kubeadm docs</a></p>
<blockquote>
<p>--cri-socket stringPath to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.</p>
</blockquote>

CC BY-SA 4.0
2021-02-06T06:50:46.170Z
2021-02-06T06:50:46.170Z
Hakob
<p>I'm not sure it's correct, but if anyone encounters similar issue, you can try again by adding the following parameters to <code>/var/lib/kubelet/kubeadm-flags.env</code></p>
<pre><code>KUBELET_KUBEADM_ARGS=&quot;--container-runtime=remote \
--container-runtime-endpoint=unix:///run/containerd/containerd.sock \
&quot;
</code></pre>
<hr />
<p>I had a similar error while updating the cluster I set up with kubespray. In this case, the file I needed to edit was <code>/etc/kubernetes/kubelet.env</code></p>
<pre><code>KUBELET_ARGS=&quot;--container-runtime=remote \
--container-runtime-endpoint=unix:///run/containerd/containerd.sock \
&quot;
</code></pre>
<p>Then I restarted the kubelet service and it started working with containerd instead of docker as I expected.</p>
<p>The answer I gave may not have been able to fully answer the question asked, but if there are those who come here by looking at the title of the question, one of the two methods I suggest will be useful.</p>
<hr />
<p>Edit After Serve Laurijssen's answer;</p>
<p>According to the <a href="https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/change-runtime-containerd/#configure-the-kubelet-to-use-containerd-as-its-container-runtime" rel="nofollow noreferrer">kubernetes docs</a>, if you are using kubeadm, you should be aware that this tool stores cri sockets as annotation for each node, so the new cri socket must be annotated for each node.</p>
<p>You can do this using below command for each node you have;</p>
<pre class="lang-bash prettyprint-override"><code>kubectl annotate node $NODE_NAME --overwrite kubeadm.alpha.kubernetes.io/cri-socket=unix:///run/containerd/containerd.sock
</code></pre>
<p>Or according to above doc, you can also use <code>kubectl edit node $NODE_NAME</code> and change cri socket annotation manually.</p>

CC BY-SA 4.0
2022-10-14T13:00:46.453Z
2022-12-16T06:03:15.903Z
2022-12-16T06:03:15.903Z
yildirim
<p>Apart from adding to the KUBELET_ADM_ARGS variable you should also set every node config to containerd.</p>
<pre><code>kubectl edit no nodeX.example.com

kubeadm.alpha.kubernetes.io/cri-socket: /var/run/containerd.sock
</code></pre>

CC BY-SA 4.0
2022-12-09T13:50:08.077Z
2022-12-09T13:50:08.077Z
Serve Laurijssen
<p>Kubernetes version: latest
Installation method: kubeadm
Host OS: debian9
container runtime: containerd</p>
<p>Kubelet fails when starting and after inspecting the logs using journalctl -xeu kubelet i see that it tries to connect to the docker.sock socket instead of containerd.sock. I tried running kubeadm --config=config.yaml using this config file</p>
<pre><code>apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
nodeRegistration:
        criSocket: &quot;unix:///var/run/containerd/containerd.sock&quot;
</code></pre>
<p>I have also tried running the kubeadm with the container runtime  85  argument, also doesn’t work.
any other ideas are appreciated and thanks</p>

<containers><kubeadm>
kubelet connecting to docker.sock instead of containerd.sock
hamzahda
# kubelet connecting to docker.sock instead of containerd.sock

(Asked by: username_0 on 2021-01-28)

Kubernetes version: latest
Installation method: kubeadm
Host OS: debian9
container runtime: containerd
Kubelet fails when starting and after inspecting the logs using journalctl -xeu kubelet i see that it tries to connect to the docker.sock socket instead of containerd.sock. I tried running kubeadm --config=config.yaml using this config file
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
nodeRegistration:
        criSocket: "unix:///var/run/containerd/containerd.sock"

I have also tried running the kubeadm with the container runtime  85  argument, also doesn’t work.
any other ideas are appreciated and thanks

**Tags:** containers, kubeadm


---

## 3 answers

### Answer by username_1 on 2021-02-06. Score: 2

[In kubeadm docs](https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-config/#cmd-config-images-pull)

> --cri-socket stringPath to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.


---

### Answer by username_2 on 2022-10-14. Score: 2

I'm not sure it's correct, but if anyone encounters similar issue, you can try again by adding the following parameters to /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--container-runtime=remote \
--container-runtime-endpoint=unix:///run/containerd/containerd.sock \
"


I had a similar error while updating the cluster I set up with kubespray. In this case, the file I needed to edit was /etc/kubernetes/kubelet.env
KUBELET_ARGS="--container-runtime=remote \
--container-runtime-endpoint=unix:///run/containerd/containerd.sock \
"

Then I restarted the kubelet service and it started working with containerd instead of docker as I expected.
The answer I gave may not have been able to fully answer the question asked, but if there are those who come here by looking at the title of the question, one of the two methods I suggest will be useful.

Edit After username_3's answer;
According to the kubernetes docs, if you are using kubeadm, you should be aware that this tool stores cri sockets as annotation for each node, so the new cri socket must be annotated for each node.
You can do this using below command for each node you have;
kubectl annotate node $NODE_NAME --overwrite kubeadm.alpha.kubernetes.io/cri-socket=unix:///run/containerd/containerd.sock

Or according to above doc, you can also use kubectl edit node $NODE_NAME and change cri socket annotation manually.


---

### Answer by username_3 on 2022-12-09. Score: 1

Apart from adding to the KUBELET_ADM_ARGS variable you should also set every node config to containerd.
kubectl edit no nodeX.example.com

kubeadm.alpha.kubernetes.io/cri-socket: /var/run/containerd.sock


---

