K3s: Lightweight Kubernetes

Super Simple Cluster Creation

If you are studying for one of the Kubernetes certification exams or if you simply want to learn more about how Kubernetes works, this article is for you.

A quick way to spin up a Kubernetes cluster is by using K3s, a lightweight version of Kubernetes created by Rancher Labs.

Why is it called K3s?

[Rancher Labs] wanted an installation of Kubernetes that was half the size in terms of memory footprint. Kubernetes is a 10-letter word stylized as K8s. So something half as big as Kubernetes would be a 5-letter word stylized as K3s. There is no long form of K3s and no official pronunciation.

Reference: http://rancher.com

Let’s Get Started

These steps are being executed on a virtual machine running Ubuntu 20.04, using Parallels software, on a MacBook Pro.

To install K3s, execute the following command.

curl -sfL https://get.k3s.io | sh -
Installed and Running Using One Command

In less than a minute, the cluster is up and running.

Let’s check the status of the control plane.

sudo k3s kubectl get nodes
Control Plane status confirmed

Take a look at the cluster’s URL info.

kubectl cluster-info
Cluster Info Output

More detailed cluster configuration is shown using this command.

k3s check-config
Snapshot of check-config output

Lastly, review the pods and services across all namespaces.

kubectl get pods, services --all-namespaces
Pods and Services Listing

Pods? Deployments? Namespaces?

Want to know more?

Go to the official Kubernetes documentation website.

Building Components on K3s

To test the cluster’s functionality, use the following commands and the yaml file to create several pods, replicasets, and deployments, and then verify all workloads are running.

First, create the nginx-deployment.yaml file using this content.

apiVersion: apps/v1
kind: Deployment
name: nginx-deployment
app: nginx
replicas: 3
app: nginx
app: nginx
- name: nginx
image: nginx:1.14.2
- containerPort: 80
# Create Multiple Pods
kubectl run nginx --image=nginx
kubectl run redis --image=redis
kubectl run memcached --image=memcached
# Create the Deployment
kubectl create -f nginx-deployment.yaml

Verify all workloads are running.

kubectl get all
Everything is working

And Just Like That…

The status of each workload is running as expected, which confirms the cluster is running in a virtualized environment after executing just a few steps.

To continue exploring what else this cluster can do, check the official Kubernetes tutorials at this link.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store