K3s Lightweight Kubernetes Distribution Targets Low Resources x86 and Arm Platforms

Kubernetes (K8s) is described as a “portable, extensible open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available. Google open-sourced the Kubernetes project in 2014”.

However, as Rancher Labs’ CEO Sheng Liang explains “existing Kubernetes distributions are often memory intensive and overly complex for edge computing environments”, so the company developed and launched K3s, a lightweight Kubernetes distribution designed for developers and operators looking for a way to run Kubernetes in resource-constrained x86, Armv7-A and 64-bit Armv8-A hardware platforms often found in edge computing environments, as opposed to the cloud.

k3s
Click to Enlarge

Rancher Labs managed to reduce the footprint of Kubernetes, and better adapt it to entry-level hardware by taking four main steps:

  • Removing old and non-essential code – Alpha functionalities, all non-default admission controllers, in-tree cloud providers, and storage drivers are disabled by default, opting instead to allow users to add in any drivers they need.
  • Consolidating the packaging of running processes – In order to conserve RAM, the processes that typically run on a Kubernetes management server were combined into a single process, including the Kubelet, kubeproxy and flannel agent processes.
  • Using containerd instead of Docker – Switching to containerd, and removing functionality like libnetwork, swarm, Docker storage drivers and other plugins, Rancher managed to reduce the runtime footprint significantly.
  • Introducing SQLite as an optional datastore – Rancher added SQLlite as optional datastore in K3s to provide a lightweight alternative to etcd.

This results in an easy to install, lightweight Kubernetes distribution with a binary of less than 40 MB, requiring only 512 MB of RAM for the server to run, 75MB RAM per node, and Linux 3.10 or greater.

One company with a specific use case was Goldwind Smart Energy which manages more than 30,000 wind turbines, and K3s allow them to deploy Kubernetes clusters on thousands of edge locations.

Instructions to install K3s on Raspberry Pi can be found in Medium, but basically if you already have a configured images for your board, all you have to do is to run:


Which should automatically install K3s for your architecture (amd64, armhf, or arm64). You’ll also find further details on the official website and K3s github repo.

To run the server:


and one agent:


Where NODE_TOKEN comes from /var/lib/rancher/k3s/server/node-token
in the server.

K3s was also demonstrated at FOSDEM 2019 as part of the talk entitled “CI/CD for embedded development with an ESP8266, Arduino-cli, Gitlab-ci, Raspberry Pi, and Kubernetes“.

Thanks to Zoobab for the tip.

Support CNX Software - Donate via PayPal or become a Patron on Patreon

3
Leave a Reply

avatar
3 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
tkaiserzoobab Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
zoobab
Guest

“K3s was also demonstrated at FOSDEM 2019 as part of the talk entitled “CI/CD for embedded development with an ESP8266, Arduino-cli, Gitlab-ci, Raspberry Pi, and Kubernetes“.”

That’s partly true, I had some problems to expose K3S and have a working setup with gitlab-ci, so at the end of the day, I did the demo with a simple SSH+Docker pull. But I will document how to integrate gitlab-ci and k3s in another branch of the git repo.

tkaiser
Guest
tkaiser

Seems the install will fail on 64-bit ARM installations running a 32-bit userland with a 64-bit kernel (which is a great idea since lower memory footprint. And DRAM is what’s missing here). The platform check only relies on the kernel version (uname -m) but if ‘One binary with zero host dependencies’ is true everything should be ok.

zoobab
Guest

You can also try it with 2 docker oneliners:

https://twitter.com/ibuildthecloud/status/1093978167818088448

$ docker run –privileged -d –name k3s ibuildthecloud/k3s:v0.1.0-rc3 server
# wait about 5 seconds
$ docker exec -it k3s kubectl get all –all-namespaces