From Zero to Kubernetes Dashboard within Minutes with k3sup and Kontena Lens

Provision servers

Prerequisite for creating Kubernetes cluster is that you have servers running somewhere, it can be on any cloud or on your home lab. If you already have servers running and you have ssh access to them, you can skip this part. I will use DigitalOcean and their `doctl` tool to provision servers, since it’s fast and easy:

$ doctl compute droplet create k3s-demo1 --image ubuntu-19–10-x64 --size 2gb --ssh-keys=<ssh key fingerprint> --region ams3
$ doctl compute droplet create k3s-demo2 --image ubuntu-19–10-x64 --size 2gb --ssh-keys=<ssh key fingerprint> --region ams3
$ doctl compute droplet create k3s-demo3 --image ubuntu-19–10-x64 --size 2gb --ssh-keys=<ssh key fingerprint> --region ams3
$ doctl compute droplet list --format Name,PublicIPv4
Name Public IPv4
k3s-demo1 142.93.133.230
k3s-demo2 165.22.204.221
k3s-demo3 167.172.45.26

Setup k3s Cluster

After the servers are ready, we can start creating k3s Kubernetes cluster with k3sup. You can download k3sup binary by following these instructions.

$ export USER=root
$ export IP=142.93.133.230
$ k3sup install --ip $IP --user $USER
$ export SERVER_IP=142.93.133.230
$ export AGENT_IP=165.22.204.221
$ k3sup join --ip $AGENT_IP --server-ip $SERVER_IP --user $USER
$ export AGENT_IP=167.172.45.26
$ k3sup join --ip $AGENT_IP --server-ip $SERVER_IP --user $USER
$ KUBECONFIG=kubeconfig kubectl get nodes
NAME STATUS ROLES AGE VERSION
k3s-demo1 Ready master 1m v1.14.6-k3s.1
k3s-demo2 Ready worker 1m v1.15.4-k3s.1
k3s-demo3 Ready worker 1m v1.15.4-k3s.1

Install Kontena Lens

To get better visibility to the cluster, we can start using it with Kontena Lens. You can download Kontena Lens here. If you don’t have a Kontena account yet, you can sign up in the app, otherwise you can just login with your Kontena account credentials.

Start Using Openfaas

To start using openfaas, we first need to install openfaas cli with the command (other installation method exists too):

$ curl -sSL https://cli.openfaas.com | sudo -E sh
$ faas-cli store deploy figlet

Summary

Like we saw, installing Kubernetes cluster with k3sup is very easy. With Kontena Lens it’s super handy to manage and operate Kubernetes clusters from your local machine. Kontena Lens is compatible with all Kubernetes clusters, so you can use it with managed Kubernetes services (GKE, EKS, AKS, DO etc) too. If you want to setup full version of Kubernetes on your own datacenter or any cloud, you can check out Kontena Pharos. It makes it super easy and it comes with useful add-ons.

--

--

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
Lauri Nevala

Lauri Nevala

Cloud-native full-stack developer. Core developer of https://k8slens.dev