Up and running K3S with Multipass on iMac or Macbook Pro

Yes, you guessed it right. yakc this time on iMac or Macbook Pro.

Credits : Sameera Liyanage

Step 1: Install Multipass

Prerequisite “brew” already installed on your iMac or Macbook Pro. I am doing this via terminal, however you can follow the official guide from multipass.run as well.
Ref: https://multipass.run/docs/installing-on-macos

#brew cask install multipass

To ensure it was installed correctly, you can run the following command.

#multipass version
multipass 1.4.0+mac
multipassd 1.4.0+mac

Step 2: Create a VM node to install k3s Server (Control Plane)

In this example I will be using Ubuntu 20.04 LTS, however you can install other versions. I have tested on 18.04 LTS and the instructions are the same. Feel free to share your experience with other available versions as well.

#multipass find

List of Currently Supported VM Images

#multipass launch — name control-plane-k3s — cpus 2 — mem 2048M — disk 5G focal

Depending on your Internet connection download speed it may take few minutes to many minutes.

#multipass list (to list the instance you just created)

Step 3: Login to the instance created and install k3s

#multipass shell control-plane-k3s

At this point you should be in the newly created virtual machine/instance. Next is to install k3s with the installation scripts written by Rancher team

#sudo apt update
#sudo apt upgrade
#curl -sfL https://get.k3s.io | sh -

All goes well in few minutes you should have all the components of Kubernetes components installed, including networking, ingress controller, loadblancer etc.

#sudo kubectl get node -o wide
should list the control-plane-k3s node you have just created

Optional Steps: Adding Additional Nodes

If you would like to add additional nodes, follow the following steps.

a. Follow step 2 and create another node
b. From the control plane node get the token required to join the nodes to the cluster
#sudo cat /var/lib/rancher/k3s/server/node-token
c. Copy the token to clipboard
d. From the recently created node run the following command to join to the cluster. Replace mynodetken with the above AND myserver with the IP address of the k3s server you have created above
#curl -sfL https://get.k3s.io | K3S_URL=https://myserver:6443 K3S_TOKEN=mynodetoken sh -
e. List all the nodes from the control plane node
#sudo kubectl get node -o wide

--

--

Kanchana Wickremasinghe
Platformer — A WSO2 Company

Husband, dad of two + 2 dogs, cook, Open Source Advocate and Co-founder of Platformer Cloud Pty Ltd (www.platformer.com — acquired by WSO2) living in Melbourne.