What is K3s? The lightweight Kubernetes distribution

Kai Hoffman avatar
By Kai Hoffman
Developer Advocate

Description

Learn about K3s, how it is different to fully stacked Kubernetes along with some insight into what it isn't


Transcription

Introduction

Welcome to this video on introduction to K3s. In this video, we will cover an overview of what K3s is, the three significant differences in which the K3s distribution differs from K8s or Kubernetes, and then look at some things that K3s is crucially trying and correct some misconceptions of what it isn't.

What is K3s?

Let's talk about K3s more generally. K3s is a slim-down but fully functional distribution of Kubernetes. It's not a fork and is a CNCF conformant, entirely compatible version of Kubernetes. If you're familiar with Linux distributions, this is kind of what we're talking about with the differences. They all broadly do the same thing, but some specialize in some aspects. And what K3s attempts to do is to be its own thing within that space. Rancher Labs originally started it with Darren Shepherd in the lead, and they are now part of SUSE.

Difference between K8s and K3s

The core concept is encapsulated in the statement of three is less than eight. So if you think of all of Kubernetes as K8s, K3s is a more approachable, less complex, smaller type of Kubernetes. So, let's look at some differences between the distributions of Kubernetes. And I'm comparing K3s here with generic K8s. K3s is packaged as a single binary rather than composed of all the different components packaged separately. It's opinionated, and we will talk about this more later. And in K3s, the control plane can act as a worker node. So let's look at the difference number one, the single binary. It's under 100 megabytes, but it contains everything you need to run a node as either a control plane node or a worker node. I will explain the unique thing that K3s does in a minute: it allows you to run a single node cluster even though it's not a cluster.

So the 100 megabytes includes the installation components for everything you need to run either as a control plane node or as a node in the cluster, including:

  • The API scheduler.
  • The Kubernetes API server.
  • The control.
  • The Kubelet.
  • A container runtime in the form of Containerd.

And let's look at how the difference of opinion comes in. So K3s bundles in, in addition to the Containerd, many other components. The idea is that all of these work together well, so you can have Kubernetes straight after the box. So the default ingress controller is Traefik. There is one container runtime at installation time; that's Containerd. It uses Flannel for virtual networking within the cluster. It bundles in CoreDNS for service discovery and has Klipper-lb like that of an embedded cluster load balancer.

There are a few other bits and pieces that K3s bundles in, but those are the main things that you as a user might be most in contact with and have to be aware of. To be a lightweight Kubernetes distribution, K3s also throws out a lot of code. And the two significant parts of code that are not included in K3s are cloud provider-specific code, which is replaced with the Cloud Controller Manager. So the idea is that there is a generic controller rather than any cloud-specific stuff within K3s. And it also removes third-party storage drivers, which are, again, provider-specific. So it replaces those with CSI, which is the generalized container storage interface. So again, there are a couple of other bits and pieces removed. Still, the important thing is that those are the two main differences compared to a generic Kubernetes distribution or Kubernetes installation and K3s.

Let's look at the third difference, the single node. So the single binary construction means that you can run by running the K3s command. You can stand up a single node. Then that node is a control plane node, but it can also perform work. If you're adding a workload to such a cluster, the memory and other system requirements increase. So even though you can technically run K3s on a device with only 512 megabytes of RAM, that's designed only around the control plane functions. The moment you add in other types of workloads or any different operation, you are looking at increased system requirements.

Myths about K3s

Let's look at some of the myths that revolve around K3s. First, there's some confusion in the media that K3s is just for edge devices or IoT. It's perfect at those things because, as I mentioned, you can stand up a cluster or a node with just 512 megabytes of RAM, whereas you would need at least double that for pretty much any other type of Kubernetes distribution.

But as I mentioned at the start, it's also CNCF conformant. So, anything you expect Kubernetes to be able to run or manage, K3s can run or manage that too. So it's not just for low-power edge devices but any Kubernetes installation. And that means it's not just for hobby or development workloads. Here at Civo, what we've done is we've taken K3s as the base Kubernetes installation for all of our managed Kubernetes customers. It means that when you start up a Kubernetes cluster on Civo, you're getting a K3s cluster that then runs your workloads for you.

An important note to make, though, is that K3s is not highly available straight out of the box. It's designed for simplicity and quick deployments. So, for example, at Civo, we can launch a cluster for you in under two minutes. But if you want to make it highly available, you might need to look at customizing some of the options and configure K3s accordingly. So, it would be best to look into some of the documentation around making your deployments in K3s highly available.

Conclusion

So, just as a quick recap, K3s is a fully compatible and CNCF conformant Kubernetes distribution. It's packaged in a single binary, 100 megabytes or slightly less, and includes everything you need while running Kubernetes. It's opinionated that it contains specific things known to work well together and throws away some other things you don't need for that configuration. And it is not just for the edge, IoT, or hobbyist projects because it's CNCF conformant. If Kubernetes can run it, K3s can run it too. All right. That's it. See you in the following video.

Civo course complete badge

You've successfully completed our course on Kubernetes introduction

We hope you enjoyed learning and encourage you to check out our other courses to further expand your knowledge on Kubernetes