Skip to main content

Your submission was sent successfully! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates from Canonical and upcoming events where you can meet our team.Close

Thank you for contacting us. A member of our team will be in touch shortly. Close

  1. Blog
  2. Article

Canonical
on 7 December 2020

How to switch the Docker container runtime to containerd with Charmed Kubernetes


This article describes how easy it is for users of Charmed Kubernetes to switch from the Docker container runtime to containerd. You may have heard that Kubernetes is deprecating Docker as a container runtime after v1.20. Docker as an underlying runtime is being deprecated in favor of runtimes that use the Container Runtime Interface(CRI) created for Kubernetes, such as containerd.

One of the hardest problems of infrastructure-as-a-service operations is replacing the component of an already deployed solution to another. Charms make this an easy 3-step process that is highly repeatable and predictable in its outcome.

Ubuntu is the reference platform for Kubernetes on all major public clouds, including official support in Google’s GKE, Microsoft’s AKS and Amazon’s EKS CAAS offerings. Canonical delivers pure upstream Kubernetes tested across the widest range of clouds — from public clouds to private data centres, from bare metal to virtualised infrastructure.

What is a charm?

A charm is a software package that bundles an operator together with metadata that supports the integration of many operators in a coherent aggregated system.

An operator packaged as a charm means that it is configured, operated and integrated in a standard way regardless of the vendor or the application. Charms enable multi-vendor operator collections with standardised behaviours, reducing the learning curve associated with each operator and creating richer application ecosystems.

Using Charms to deploy and operate Kubernetes leads to highly automated, repeatable, and version controlled clusters, which expose the identical operational paradigms independent of the substrate they run on. For example, deploying Charmed Kubernetes on top of AWS feels identical to deploying it on VMware or bare-metal.

Charms provide the necessary operational intelligence encoded in the “methods” belonging to each of the “objects” on the model describing the cluster. This leads to a tangible difference for the operator.

Switching the Docker runtime to containerd in a charmed Kubernetes cluster

Using Charms, changing the Docker runtime to containerd is essentially a 3-step process. As an example, I deployed Charmed Kubernetes on AWS and changed the containerd runtime in the YAML bundle to Docker since it already comes with containerd by default. Here is a (cropped) screenshot of how that looks like:

$ juju status

The current container runtime installed is Docker. However, the Docker runtime is being deprecated, so we’re going to change it to containerd.

1.) Remove the Docker runtime:

$ juju remove-application docker

This will remove the Docker runtime from the Kubernetes cluster. Run the “juju status” command again and wait until all units are back in the “active” state.

2.) Deploy the containerd runtime:

$ juju deploy cs:~containers/containerd

Juju will deploy the new containerd runtime. This will reflect in the status of the Charmed Kubernetes cluster. 

3.) Add the relation to the Kubernetes masters and workers:

$ juju add-relation containerd kubernetes-master:container-runtime

$ juju add-relation containerd kubernetes-worker:container-runtime

The kubernetes-master unit will show various status messages as it goes through the switch process. While this is happening, the workload is marked as in “maintenance” mode.

The Charms, containing all the operational logic behind configuring and operating a K8s cluster, will manage and coordinate everything necessary to install and configure the new containerd runtime into the existing cluster.

Once the switch has been completed, your picture changes to this. Note the containerd runtime instead of Docker:

Replacing the container runtime in K8s comes with many gotchas and requires a specialised skill set to perform well. Using charms, this process becomes much easier and predictable by reducing the complexity to a simple to follow, 3-step process, which remains identical across all substrates supported by Charms, whether on-premise or on the public cloud.

Install Kubernetes on Ubuntu

Kubernetes on Ubuntu is free to use and always current – you get the latest innovations from the Kubernetes community within a week of upstream release. It works on any cloud (public, private, and bare-metal). Kubernetes on Ubuntu is the productive, open source way to manage containers and microservices, automating the time-consuming tasks of installing, patching, upgrading, and carrying out cluster health checks. Try Kubernetes on Ubuntu today!

Related posts


Marcin "Perk" Stożek
14 March 2024

How should a great K8s distro feel? Try the new Canonical Kubernetes, now in beta

Kubernetes Article

Try the new Canonical Kubernetes beta, our new distribution that combines ZeroOps for small clusters and intelligent automation for larger production environments that also want to benefit from the latest community innovations ...


Mita Bhattacharya
6 November 2024

Meet Canonical at KubeCon + CloudNativeCon North America 2024

Cloud and server Article

We are ready to connect with the pioneers of open-source innovation! Canonical, the force behind Ubuntu, is returning as a gold sponsor at KubeCon + CloudNativeCon North America 2024.  This premier event, hosted by the Cloud Native Computing Foundation, brings together the brightest minds in open source and cloud-native technologies. From ...


Michael C. Jaeger
29 April 2024

Kubernetes backups just got easier with the CloudCasa charm from Catalogic

Charms Article

For a native integration for Canonical’s Kubernetes platform, Juju was the perfect fit, and the charm makes consuming CloudCasa seamless for users. ...