In this tutorial I will show you one awesome utility, called k3sup that allows you to provision k3s on any local or remote virtual machine, whether the architecture is x86_64, arm, arm64 or amd64.

The k3sup tool is written in Go and cross-compiled for Linux, Windows, MacOS and the RaspberryPi (ARM).

All you need is the k3sup binary and ssh access to the node where you want to provision k3s on.

With k3sup, you can install to Cloud, VM's or Raspberry Pi's. In this guide, I will be showing you how to provision a single node of k3s on a Raspberry Pi that is located on my local network.

With release 0.2.0 of k3sup, the tool allows you to form clusters as well

Generate a SSH Key

I have SSH access to my raspberry pi via password authentication, so let's generate a SSH key that we will be using for k3sup:

$ ssh-keygen -b 2048 -f ~/.ssh/k3sup -t rsa -q -N ""

Now copy the key over to the Raspberry Pi:

$ ssh-copy-id -i ~/.ssh/k3sup [email protected]

Testing that SSH works with our new SSH key:

$ ssh -i ~/.ssh/k3sup [email protected]
pi@raspberrypi:~ $ exit
logout
Connection to 192.168.0.120 closed.

Install k3sup

Installing k3sup is as easy as:

$ curl -sLS https://get.k3sup.dev | sudo sh

Test that everything is in order:

$ k3sup help
Usage:
  app [command]

Available Commands:
  help        Help about any command
  install     Install k3s on a server via SSH
  version     Print the version

Flags:
  -h, --help   help for app

Use "app [command] --help" for more information about a command.

Provision k3s on our Raspberry Pi

Note: If you are looking to deploy a multi-master k3s cluster, have a look at this post

Let's provision k3s on the Raspberry Pi via our LAN connection with one easy command:

$ k3sup install --ip 192.168.0.120 --user pi --ssh-key ~/.ssh/k3sup
...
[INFO]  systemd: Enabling k3s unit
[INFO]  systemd: Starting k3s
 Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
...
Saving file to: /Users/ruan/workspace/k3sup-tryout/kubeconfig

By default the kubeconfig will be saved in the current working directory, but of course you can overwrite this behavior using the help section.

Access Kubernetes

I will be moving my kubeconfig to my default kube config path:

$ mv kubeconfig ~/.kube/config

Use kubectl to show the nodes:

$ kubectl get nodes
NAME          STATUS   ROLES    AGE   VERSION
raspberrypi   Ready    master   43s   v1.14.5-k3s.1

Pretty sweet right? :D

You can use k3sup to deploy k3s to multiple destinations, which makes it really convenient, have a look at the demo on the k3sup project page for more info and make sure to star the project.

What do you think?

The fact that it's so easy to provision k3s and from release 0.2.0 that you can form clusters with k3sup is really awesome.

I am really impressed with k3sup and it's definitely worth checking it out.

I believe it's always great providing feedback, and if you found this as useful as I did, please go and star the k3sup project and feel free to share the word.

Resources:

Thank You

Thanks for reading. If you would like to check out more of my content, check out my website at ruan.dev or follow me on Twitter @ruanbekker