Create a K3s Kubernetes Cluster on Mac M1 using Multipass (Ubuntu VM)
Have a look at the following blog post for more information on how to use the Multipass tool to create Ubuntu VMs on your Mac M1:
Step 1:
Create 1 master node and 2 worker node VMs using multipass:
multipass launch — name k3sMasterNode --cpus 2 --memory 4G --disk 20G
multipass launch — name k3sWorkerNode1 --cpus 2 --memory 4G --disk 20G
multipass launch — name k3sWorkerNode2 --cpus 2 --memory 4G --disk 20G
Step 2:
Deploy K3s on Master node:
multipass exec k3sMasterNode -- /bin/bash -c “curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE=”644" sh -”
Retrieve the master node IP:
K3S_MASTERNODE_IP=”https://$(multipass info k3sMasterNode | grep “IPv4” | awk -F’ ‘ ‘{print $2}’):6443"
Retrieve the Token:
TOKEN=”$(multipass exec k3sMasterNode -- /bin/bash -c “sudo cat /var/lib/rancher/k3s/server/node-token”)”
Step 3:
Now, deploy K3s on Worker Node1:
multipass exec k3sWorkerNode1 -- /bin/bash -c “curl -sfL https://get.k3s.io | K3S_TOKEN=${TOKEN} K3S_URL=${K3S_MASTERNODE_IP} sh -”
Deploy K3s on Worker Node2:
multipass exec k3sWorkerNode2 -- /bin/bash -c “curl -sfL https://get.k3s.io | K3S_TOKEN=${TOKEN} K3S_URL=${K3S_MASTERNODE_IP} sh -”
Use Multipass to log in to the Master node and check if the kubernetes cluster is created successfully:
multipass shell k3sMasterNode
kubectl get nodes