Showing posts with label K3s. Show all posts
Showing posts with label K3s. Show all posts

Oct 3, 2022

Start K3s with Multipass

Prerequisite: You need to have a working multipass, and preferably a Linux-based host. (I'm using WSL 😎 )

Then follow the steps to create the virtual machines and follow by create the k3s cluster. K3s promises to be a lightweight K8s. 

Here are the tools used and the description.

Tools Description
Multipass It's a system that orchestrates the creation, management and maintenance of virtual machines and associated Ubuntu images to siplify development.
K3s K3s is a certified Kubernetes distribution designed for production workloads in unattended, resource-constrained, remote locations or inside IoT appliances.

First, we need 1 master node (kmaster) and 2 worker nodes (kworker1 and kworker2).

$ multipass launch --name kmaster
$ multipass launch --name kworker1
$ multipass launch --name kworker2

Second, we need to create the K3s cluster. 

$ multipass exec kmaster -- /bin/bash -c "curl -sfL https://get.k3s.io | sh -"

$ K3S_NODEIP_MASTER="https://kmaster.mshome.net:6443"

$ K3S_TOKEN="$(multipass exec kmaster -- /bin/bash -c "sudo cat /var/lib/rancher/k3s/server/node-token")"

$ multipass exec kworker1 -- /bin/bash -c "curl -sfL https://get.k3s.io | K3S_TOKEN=${K3S_TOKEN} K3S_URL=${K3S_NODEIP_MASTER} sh -"

$ multipass exec kmuworker2 -- /bin/bash -c "curl -sfL https://get.k3s.io | K3S_TOKEN=${K3S_TOKEN} K3S_URL=${K3S_NODEIP_MASTER} sh -"