k0s — Yet Another Kubernetes Distro !!

k0s — Yet Another Kubernetes Distro !!

Yes, you heard it right, yesterday Mirantis launched k0s a frictionless kubernetes distribution. k0s is a single binary that is packed with all the components to run the Kubernetes cluster in very little time by just having the binary on all the hosts.

Now by this time you already must have started making comparisons of k0s with k3s which is a CNCF sandbox project & a CNCF certified kubernetes distribution. But first let us see what k0s has to offer, its vision, a demo, and then a comparison with k3s.

What is behind the name? - Zero friction meaning anyone can install without any kubernetes expertise.

  • Zero OS dependencies
  • Zero cost as its open-source
  • Zero Downtime as it comes with automated cluster lifecycle management

Features:

  • It is a single binary(around 165 mb) with no OS dependencies
  • FIPS security compliance = k0s kubernetes core components + OS dependencies + components packaged on top
  • Isolated Control Plane - the server will not have a container engine or kubelet running by default, meaning no workload can run on the server.
  • Custom worker profiles
  • Future native cluster backup/restore and other features

Note - Components included in binary will be explained in the comparison with k3s section

Architecture:

k0s uses Rancher's Kine) to allow a wide variety of backend data stores to be used such as MySQL, PostgreSQL, SQLite, and dqlite. k0s uses Konnectivity by default that is responsible for the control plane and worker bidirectional communication.

Other Notable points -

  • From the commits k0s was previously called MKE (Mirantis kubernetes/container engine I suppose )
  • It is claimed to be a successor of Pharos Project.
  • k0s can be run as docker as well.
  • k0s allows extending the functionality of kubernetes cluster by using extensions -> atm only helm CRD’s can be used.

Demo - For this demo, we will take 2 CentOs plain Virtual machines and create a Kubernetes cluster using k0s

Installing the binary Download the k0s binary on both the nodes:

curl -sSfL k0s.sh | sh
Downloading k0s from URL: [https://github.com/k0sproject/k0s/releases/download/v0.7.0/k0s-v0.7.0-amd64](https://github.com/k0sproject/k0s/releases/download/v0.7.0/k0s-v0.7.0-amd64)

Run the server on the node(the machine where you want the Control plane to be) with default config

k0s server

you can see all the control plane components running as processes

**ps -ef | grep k0s
**root     11169 11009  1 19:03 pts/0   00:00:00 **k0s server**
root     11175 11169  5 19:03 pts/0   00:00:02 **/var/lib/k0s/bin/etcd **...
root     11184 11169  6 19:03 pts/0   00:00:02 /var/lib/k0s/bin/**kube-controller-manager** ...
root     11187 11169 36 19:03 pts/0   00:00:12 /var/lib/k0s/bin/**kube-apiserver**...
root     11191 11169  0 19:03 pts/0   00:00:00 /var/lib/k0s/bin/**konnectivity-server**...
root     11196 11169  3 19:03 pts/0   00:00:01 /var/lib/k0s/bin/**kube-scheduler**...
root     11209 11169  0 19:03 pts/0   00:00:00 k0s api --config=/root/k0s.yaml


**Create the token for worker**

k0s token create --role=worker



On the worker node run the join command with the token just generated

k0s worker



you can see the k0s processes on the worker node as well:

ps -ef | grep k0s

root 12430 12356 2 19:09 pts/0 00:00:02 k0s worker .... root 12436 12430 18 19:09 pts/0 00:00:17 /var/lib/k0s/bin/containerd ... root 12441 12430 3 19:09 pts/0 00:00:02 /var/lib/k0s/bin/kubelet ... root 12523 1 0 19:09 pts/0 00:00:00 /var/lib/k0s/bin/containerd-shim-runc ... | | | root 13504 1 0 19:10 pts/0 00:00:00 /var/lib/k0s/bin/containerd-shim-runc-


From the control plane, you can see the status of the worker node (after installing kubectl as it is not packaged within the binary)

curl -LO "[https://storage.googleapis.com/kubernetes-release/release/$(curl](https://storage.googleapis.com/kubernetes-release/release/$(curl) -s [https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl](https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl)"
chmod +x kubectl 
mv kubectl /usr/local/bin/
mkdir ~/.kube
cp /var/lib/k0s/pki/admin.conf ~/.kube/config

kubectl get nodes
NAME   STATUS   ROLES    AGE    VERSION
test   Ready    <none>   7m1s   v1.19.3

Now we have a Kubernetes cluster up and running with the Kubernetes version v1.19.3

Comparison with k3s:

Note: k0s does not run on Arch Linux(thanks to Alex Ellis for pointing this) Though there are a few features in k0s that makes it different from k3s but they have a lot in common as well. IMO it would have been great if there were contributions made to k3s instead of creating a new distribution itself.

Let me know your thoughts on it in comments or on reddit.

Saiyam Pathak Director of Technical evangelism, Civo CNCF Ambassador