How to switch from Docker to Containerd on a kubeadm
-managed Kubernetes node:
-
Install Containerd.
-
Edit
/etc/default/kubelet
and add the following line:KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock
If
KUBELET_EXTRA_ARGS
exists already, add the additional parameters to it instead. -
Restart
kubelet
. -
Uninstall Docker.
-
To make
kubeadm
aware of the change (so thatkubeadm upgrade apply
works): Let${NODE_NAME}
be the name of your node. Run:kubeadm edit nodes/${NODE_NAME}
Look for the
kubeadm.alpha.kubernetes.io/cri-socket
annotation. Change its value to/run/containerd/containerd.sock
.
Now everything should be set up for Containerd and you can do such fun things as running Kubernetes pods in Kata containers.
Presumably, these instructions will work for a migration to CRI-O and other container runtimes as well, but I have not tried.