Canonical introduces high-availability Micro-Kubernetes

Want an even better way to run small Kubernetes clusters on your developer workstations, IoT devices, or the edge? Canonical has the program for you.
Written by Steven Vaughan-Nichols, Senior Contributing Editor

If you've been hiding under a rock -- and who could blame you these days? -- you may have missed how totally Kubernetes now dominates container orchestration. One way to quickly get up to speed on Kubernetes is with Canonical's  MicroK8s. This is an easy-to-run and install mini-version of Kubernetes. And now Canonical has added autonomous high availability (HA) clustering to it. 


You see MicroK8s, although small and simple, is a full-fledged Kubernetes implementation. It includes automatic updates and well-defined security capabilities. Microk8s also includes Canonical open-source add-on services such as a container registry, storage pass-through, and native GPGPU enablement for hardware acceleration and machine learning workflows.

Now, with HA, MicroK8s is ready to move from Internet of Things (IoT) implementations, testing out Kubernetes implementations on a workstation, or simply learning Kubernetes to bigger, better cloud jobs.  

With the new MicroK8s release, HA is enabled automatically once three or more nodes are clustered, and the data store migrates automatically between nodes to maintain a quorum in the event of a failure. Designed as a minimal conformant Kubernetes, MicroK8s installs, and clusters easily on Linux, macOS, or Windows.

To work, a HA Kubernetes cluster needs three elements. Here's how it works in MicroK8s.

  • There must be more than one worker node. Since MicroK8s uses every node as a worker node, there is always another worker available so long as there's more than one node in the cluster.
  • The Kubernetes API services must run on one or more nodes so that losing a single node would not render the cluster inoperable. Every node in the MicroK8s cluster is an API server, which simplifies load-balancing and means we can switch instantaneously to a different API endpoint if one fails.
  • The cluster state must be in a reliable datastore. By default, MicroK8s uses Dqlite, a high-availability SQLite, as its datastore.

Dqlite is Canonical's raft-enhanced SQLite. Raft is a popular consensus replication algorithm for building resilient, strongly consistent systems. Dqlite reduces the cluster memory footprint and automates datastore maintenance. If you want, you can also configure MicroK8s to use etcd, but Dqlite provides automatic, autonomous high availability.

To get this to work, all you need is to have three or more nodes in your cluster. Once you have that, Dqlite is automatically highly available. If the cluster has more than three nodes, then additional nodes will be standby candidates for the datastore and promoted automatically if the datastore loses one of its nodes. The automatic promotion of standby nodes into the voting cluster of Dqlite makes MicroK8s HA autonomous and ensures that quorum is maintained even if no administrative action is taken.

MicroK8s automatically chooses the best nodes to provide the datastore. If one datastore node fails, the next best one is automatically promoted in its place. MicroK8s manages its own control plane, ensuring API services stay up and running.

This is pretty darn neat, and it's remarkably smooth for such a small Kubernetes implementation. The result is "a zero-ops experience that is perfect for distributed micro clouds and busy administrators," claimed Canonical Alex Chalkias, datacenter solutions product manager.

Charles Adetiloye, co-founder and MLOps Platform Engineer at MavenCode agreed. His company uses it for building machine learning (ML) model pipelines for production deployment at scale with Kubeflow

For MavenCode, Adetiloye said, "MicroK8s comes in handy for our Data Scientists and ML Engineers to quickly prototype, build, and deploy these pipelines. MicroK8s is very easy to set up and configure, extremely lightweight and it easily emulates our production environments for seamless migration and deployment of the pipelines."

But Canonical points out MicroK8s is also useful in production. It can be used to harden industrial IoT applications; edge nodes such as remote branch office racks, retail points of sale, cell towers, or cars; and mission-critical control systems. In short, the new microK8s may be just what your company needs for developing new apps and deploying them to IoT devices and the edge.

Related Stories:

Editorial standards