K3s is a simple and lightweight Kubernetes distribution. It is designed to be easy to install, run, and manage.
It is developed by Rancher Labs and aims to simplify Kubernetes deployment and operation, especially for resource-constrained environments where we need a K8s solution with a small footprint. It is also designed for situations in which we just need a simple and easy Kubernetes solution.
Why is it called K3s? Kubernetes is often referred as K8s, using the 8 to represent the 8 letters between the K and the s in Kubernetes. K3s aims to be half the size of a K8s installation, so the 10 letters Kubernetes word would become a 5-letter representation, that is 3 letters between the K and the s --> K3s
K3s Main Features
Lightweight
K3s is a single binary of less than 100 MB, which bundles all the Kubernetes control plane components and dependencies, including the containerd runtime. It significantly reduces the resource overhead compared to a full Kubernetes installation. K3s is designed to use half the memory of a regular K8s installation.Simplified Installation
K3s packages the dependencies and add-ons required for a regular K8s installation into a single binary so that we don't have to install multiple components or plug-ins. K3s can be installed with a single command, making it much more accessible for users who might find the traditional Kubernetes installation process complex.Reduced Dependencies
It removes unnecessary drivers and cloud providers that are not essential for most users. This contributes to its smaller footprint.Embedded Components
K3s includes embedded components such as an SQLite database (which can be replaced with etcd, MySQL, or PostgreSQL for more demanding workloads), simplifying the setup process and reducing the footprint.Packaged add-ons
K3s includes a set of packaged add-ons to provide out-of-the-box functionality such as flannel CNI, a Helm controller and Traefik ingress controller.Optimized for Edge Computing and IoT
K3s is designed to run in resource-constrained environments such as edge computing, IoT devices, and ARM processors, making it ideal for use cases where standard Kubernetes would be too heavy.Easy to use
K3s provides some sensible secure defaults and automates complex cluster operations like the distribution of certificates. If you don't have specific requirements for customizing your K8s cluster and the standard configuration is enough, K3s is probably easier to use.Production-Ready
Despite being lightweight, K3s is fully conformant with Kubernetes, meaning it can run production workloads just like a standard Kubernetes cluster.Continuous Integration
K3s can be very useful in Continuous Integration scenarios. Many times in CI scenarios we want to spin up temporary and ephemeral environments that mirror our production environment. For example, let's say you're building an app and you just want to make sure it'll work in K8s. A quick way of spinning a K8s cluster for the test could be K3s.Testing
Similarly, K3s is a good option for development and testing purposes. For us, Mulesoft Architects and Developers, K3s can be a great way for us to get a Runtime Fabric instance for dev or testing. This way we don't have to go through all the installation process of an EKS, AKS or Openshift cluster and the installation and configuration of an ingress controller.K3s Architecture
K3s Server
In a regular K8s distribution we've got a K8s control plane and worker nodes. Similarly, K3s has a K3s server, which is basically a K8s control plane with all the control plane components (Kube API Server, Scheduler, Controller Manager...) packaged into a sinle process.We also have, as part of the K3s server, the SQLite embedded database, which replaces the etcd instance that we'd find in a traditional K8s installation.
In addition, there's a Tunnel proxy, which is specific to K3s, and is used by the different K3s components to communicate securely with each other.
K3s Agent
Next we've got the K3s agent, which is basically the worker node in our K3s cluster. In here we'll find the kubelet, the kube proxy components and Flannel as the CNI implementation.We'll also find the Tunnel proxy that allows the components of the K3s agent to communicate with the K3s server. So, esentially, the K3s agent consists of all the components of a traditional K8s worker node running under a single process.
Outside the K3s server and agent processes we've got the containerd runtime, which is responsible of running our pods. It's outside the K3s server and agent but K3s still manages the installation and configuration of containerd.