3

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

3 Answers 3

2

In kubeadm docs

--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.

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 Serve Laurijssen'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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.