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.
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.
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
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.