Ultra fast, ultra small Kubernetes on Linux – K3S beating minikube

0

imageThe easiest way I knew for running a local Kubernetes cluster was minikube. It installs like a breeze and creates a fresh clean cluster with minimal effort on my part. Sure, it takes a while to get going and uses quite a bit of system resources, but it performs quite a feat. I am quite fond of it really.

Last week I learned about k3s (https://k3s.io/) – light weight Kubernetes, for Linux servers in general and with support for ARM64 and ARMv7. k3s works great from something as small as a Raspberry Pi or as large as an AWS a1.4xlarge 32GiB server. I took k3s for a spin. In a Linux environment it has a Kubernetes cluster running in hardly any time at all – and with minimal system overhead.

The quick steps to get going:

To download k3s

curl -sfL https://get.k3s.io | sh –

imageThis downloads and starts k3s. After a few seconds, the k3s server is running and K8S is spinning in the background.

k3s kubectl get node

to check on the K8S node:

image

To run a Deployment for nginx:

sudo k3s kubectl create deployment nginx –image=nginx

and to expose it as a service:

sudo k3s kubectl create service nodeport nginx –tcp=80:80

At this point, the container image was downloaded and a deployment created (just regular Kubernetes stuff really) and now the service was created and exposed on a local node port 30805:

SNAGHTML77824d5b

I can access the NGINX server from a CURL or a local browser:

image

image

This is not so surprising – that is K8S for you. The ease of installing and running a local Kubernetes cluster with so little overhead is the real magic here. What can we do – if the cost of running a Kubernetes cluster is so small? If it fits in edge devices in IoT environments? Note: k3d is a utility designed to easily run k3s inside Docker.

As stated on the k3s website: k3s is wrapped in a simple package that reduces the dependencies and steps needed to run a production Kubernetes cluster. Packaged as a single binary, k3s makes installation and upgrade as simple as copying a file. TLS certificates are automatically generated to ensure that all communication is secure by default. And: k3s is a Certified Kubernetes distribution designed for production workloads in unattended, resource-constrained, remote locations or inside IoT appliances.

For detailed instructions: https://rancher.com/docs/k3s/latest/en/

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.