Replacing Docker with ContainerD as the Kubernetes CRI

Ladies and gentlemen, Docker is done, everybody go home. Just kidding.

Seriously, though, we have roughly a year to get rid of Docker as the container runtime in Kubernetes. In version 1.20 (which is coming out very soon) Docker will be deprecated. And in version 1.23 its support will be removed altogether. To avoid trouble upgrading the cluster later, it's worth putting in the work now.

We'll replace it with ContainerD, because ContainerD is exactly what sits under the hood of Docker anyway. We just need to cut out all the middlemen.

Right now, the move can be done painlessly only on Linux nodes. ContainerD for Windows has been released, but it still doesn't work very well in Kubernetes. There's a year of filing off the rough edges ahead.

Let's begin.

  1. Create the file /etc/systemd/system/kubelet.service.d/0-containerd.conf with the following content:
[Service]
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
  1. If we have Docker, then ContainerD is already on the nodes. It just needs to be initialized. Here's how:
sudo containerd config default | sudo tee /etc/containerd/config.toml
  1. Reboot the node. Or don't reboot, and instead fiddle with restarting docker, kubelet, containerd... Rebooting is easier.
  2. Check the result:
kubectl get nodes -owide

As the container-runtime, we expect to see something like containerd://1.3.9

That's all.

Only registered users can leave a comment.

Sign in or register to leave a comment.