4

What is K3s and its use cases

 2 years ago
source link: https://blog.knoldus.com/what-is-k3s-and-its-use-cases/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Reading Time: 4 minutes

WC-IIifN0zGYWe2xi7sZy4HyIMEc5dUzNtJUhJI8s-XlQ8QEPMo0VB7R19A2bRCnnAJ1GJ9De9Va8MhJ-h3sPk3RNKFUceptWR9Mo0G8o3FLPwsN8KCuBYdSEytXqGkEyfehUa2F

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.

mnRvJWJ1tyK4-3OAp0kFxcAsoNaVLxrTJ5OGsY0dcuk0p2cDQIeKxeNr4gnRJ6lZjJ8opWk4HGh73xkB_0SepJEeVpgaR-YsL3qeeJ78aD9vvbaWPr88w2jfxVXJpQLtN2O1mlpe

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.

bj8R3G-bbtkjwueia9bE7mDksZ1hdKu403YTyuptFXzTN4WCNabyx-VH2QT3_iTcebrQe0h3u8GdwKciWYNg6oLc5alXvhF03YfCyPSq5A6TKsuTtv2uSoqcc74myr8D3wJM5Bc7

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:

5Ddy_Ufu27KRA6jwRm1KCzhLmy7vUKfwce7Yk4oy8ty5Vz-4jGEIJr_O46w38tJrv-WzUk9nCUKb88ObAzW2sNNH4uVrxx6P1sypQGrlP3IWzm7YXtoOrrAnjFwXFQ-Bpghm1zgp

Install Docker CE on Ubuntu 20.04:

P7hm92Cm3F6vqzGCtLljnKN6MTph2LMaSM5H54geOD1rpG8dKbtTvSpbWgkd9BScE0BheRoelrBlbSNbdT9BgC-eKu2awsfH7NJFq5O8WkUf3FOi8FpipiNHeMDBZQH3bMwijMpd

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

YWdAPGNspbGx5hGs39GXL4d_b8UdFahlLqc8ncPMbpc8lSFD3k5SYjlv4BnvoQywXbP1s4OzWrtT5jmPDWI7sWEEiqGHHAZxsHWPmjEg-gE5GuE5ik-NwHfmK3DO8nSA6Ll4BNqM

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.

vneD4W4zsftWGCq0UKotFnxPxAEemdHfw_0h4iH5LFEEw7oHr4574zoA2puQb_3o9Ta69CFGlFVbgmdDFyqmcKGLrwW_gOvacey4t0nv8pJ8ud9G63WNu2LP98YGpTwbp7ce-HG5

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

0fOxEB1U9ANcAvGRumFeZTACkxMcJ4_UHOt_hhgy24POa-i5jX5KkctKlwtxcs7BJKAgHktcC4EtqbZrnI6rCoV12hrHaVSioP0W1nZ-ErMJhLy3ahk5x5ISZmsHz2EJYyP8uDLr

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

3JacZBrG4hLWWoMWgGnzOWCRcuaUGeCDLnm7XD3m9gAkU5YHlIKSdnoL1-EPaWyfYp0jTRGn6xriKIiu4HfBWIURrn-70DTA8tTygfTGrz57GR-Rh54Ac30qaP6qPoekr72HED8A

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?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK