Docker to Containerd migration in live k8s cluster

In this article, we are going to see how we can disable docker support in k8s and add Containerd support in the live cluster.

If you are using Docker in Kubernetes cluster, then you need to move to another container platform.

Yes, you read it right!! We have to move to Containerd ( or similar technology) because Kubernetes removing support for docker.
Let's see why.

First of all, in simple layman's terms, Docker doesn't understand the language of Kubernetes. For that Docker uses Docker shim and Docker's whole stack, then it uses Containerd as its underlying CRI to create, delete, update containers.




Docker's CLI provides a rich set of commands, making it a very useful development tool. But it is not the best fit for troubleshooting on Kubernetes nodes. Some Docker commands are not useful to Kubernetes, such as docker network and docker build; and some may even break the system, such as docker rename. Crictl provides just enough commands for node troubleshooting, which is arguably safer to use on production nodes.

Below are some comparisons between docker and Containerd.








Here we have cluster with 6 nodes, 1 for loadbalancer , 3 for master nodes and 2 for worker nodes.


First, we start with disabling scheduling on one of our worker nodes.



Then go to the kworker1 node to check packages for docker and check the status of Kubelet.


Now, we will stop Kubelet and remove the docker packages installed.





Now check for Containerd's config file called 'toml' file.


In toml file enable cri plugin by commenting line, disabled_plugin = ["cri]".




Now, tell kubelet which container runtime you want to use, to do this we need to append some parameters (--container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock)  in "/var/lib/kubelet/kubeadm-flags.env" file.


After this, restart the Kubelet service.


Finally, we can uncordan the node using:"kubectl uncordan kworker1"., then we can see our runtime has been changed to Containerd.


We can do the same for all of our master and worker nodes.

Thank you for your time.




Comments