What is K3s and its use cases

kubernetes
Reading Time: 4 minutes

what is K3s?

K3s is the lightweight Kubernetes Distribution. In the Kubernetes world, a distro is simply a way to get Kubernetes up and running.

K3s is a great way to get Kubernetes up and running quickly and easily, without the need for developers to have a detailed knowledge of the inner workings of Kubernetes. K3s also won’t take up too many local resources, making it a great option for local Kubernetes development environments.

There are many Kubernetes distros available today – kubeadm, Minikube, and RKE to name just a few.

What’s so special about K3s?

Here are the key things that make K3s stand out.

  • Lightweight : K3s is packaged as a single binary that’s 54 megabytes. This single binary includes everything you need to get your Kubernetes master and worker components running.
  • Low memory/CPU footprint : A single-node configuration (datastore, control-plane, and kubelet in a single process) requires about 512 megabytes of RAM; a worker node’s footprint is half that.
  •  CNCF-certified : This distro is CNCF certified distro that means it passed the conformance tests used by the CNCF to certify Kubernetes distros.

Why to choose K3s instead of full K8s?

Being a single binary it’s easy to install and bring up and it internally manages a lot of pain points of K8s like:

  • Internally managed Etcd cluster
  • Its also Internally managed TLS communications
  • Internally managed certificate rotation and distribution
  • Integrated storage provider (localpath-provisioner)
  • Low dependency on base operating system


How K3s is Different?

  1. K3s has no external dependencies :

Means you don’t need to install anything to get it running. It can run on any Linux box with empty root and /proc, /sys and /dev mounted in other words K3s is a self-extracting archive – a data directory is created on startup with all the necessary host binaries to get Kubernetes up and running, similarly we use Buildroot to compile dependencies for each different architecture.

2. K3s support for database options

K3s support different database backends, including MySQL, Postgres, and SQLite. it supports not only Etcd to hold the cluster state but also SQLite (for single-node, simpler setups) or external DBs like MySQL and PostgreSQL 

3.  Everything developed in k3s can be replaced or disabled in other words you can swap out the default container network plugin, ingress controller, or service lb functions.

K3s is a great tool any time you want a quick and simple lightweight Kubernetes cluster, especially if you don’t care too much about customization however K3s includes packaged add-ons and sensible defaults that make it powerful right out of the box.

Installing K3s

Step 1: Update Ubuntu system

Firstly, you have to update your system

sudo apt update

Step 2: Map the hostnames on each node

Secondly,Make sure you have the hostnames mapped on each node. This is by adding the IP and hostname of each node in the /etc/hosts file of each host.

Step 3: Install Docker on Ubuntu 20.04

Thirdly, The next step is to install docker on on the hosts.Kubernetes is used to manage Docker containers on hybrid cloud infrastructure. Thus we need to have docker up and running on all the nodes before we can setup K3s.

Add Docker APT repository:

Install Docker CE on Ubuntu 20.04:

Add your user to Docker group to avoid typing sudo everytime you run docker commands.

Step 4: Setup the Master k3s Node

In this step, we shall install and prepare the master node. This involves installing the k3s service and starting it.

Run the command above to install k3s on the master node. The script installs k3s and starts it automatically.

Finally,To check if the service installed successfully, you can use:

Conclusion

I hope after reading this blog you will have better understanding of the k3s lightweight Kubernetes distribution and in addition you got to know its installation.It’s easy to install and manage, and it’s even production-ready therefore in any situation where you need some quick and easy container orchestration, why not try K3s?

Written by 

Hi community, I am sachin from Ghaziabad a tech enthusiastic trying to make something useful for you.

2 thoughts on “What is K3s and its use cases3 min read

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading