Skip to content

Alexander-Vays/k3s-mac-m4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Running k3s on a MacBook M4 Using Multipass

Step 1: Install Multipass

If you don't have Multipass installed:

brew install --cask multipass

Step 2: Launch a Virtual Machine (VM)

Create a VM with Ubuntu (ARM64 architecture, suitable for Apple Silicon):

multipass launch --name k3s-master --mem 4G --disk 20G
multipass launch --name k3s-worker --mem 8G --disk 20G --cpus 4

Step 3: Connect to the VM

multipass shell k3s-master

Step 4: Install k3s

curl -sfL https://get.k3s.io | sh -

Lets find out IP of the VM & k8s token so that we can spin up a new VM and add it to this cluster.

multipass exec k3s-master sudo cat /var/lib/rancher/k3s/server/node-token
multipass info k3s-master | grep -i ip
multipass shell k3s-worker
ubuntu@k3s-worker:~$ curl -sfL https://get.k3s.io | K3S_URL=https://192.168.64.28:6443 K3S_TOKEN="K10c..2::server:7757..f4" sh -

We can verify if the node is added correctly from k3s VM.

multipass exec k3s-master sudo kubectl get nodes

NAME         STATUS   ROLES                  AGE     VERSION
k3s-master         Ready    control-plane,master   2d23h   v1.32.5+k3s1
k3s-worker   Ready    <none>                 2d23h   v1.32.5+k3s1

Step 5: Access Kubernetes from the Host

  1. To access kubectl from your macOS host:

Copy the kubeconfig file from the VM:

multipass exec k3s-master -- sudo cat /etc/rancher/k3s/k3s.yaml > kubeconfig
  1. Replace the internal IP (127.0.0.1) with your VM's IP:

Get the VM IP:

multipass info k3s-master

Edit kubeconfig and replace:

server: https://127.0.0.1:6443

with:

server: https://<YOUR_VM_IP>:6443
  1. Use it with kubectl:
export KUBECONFIG=$PWD/kubeconfig
kubectl get nodes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published