Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save erhangundogan/da9fd16f6190e3bc3d0548dee4b4f725 to your computer and use it in GitHub Desktop.
Save erhangundogan/da9fd16f6190e3bc3d0548dee4b4f725 to your computer and use it in GitHub Desktop.
Create K3S Cluster with multipass
#!/bin/bash
multipass launch -c 1 -m 1G -d 4G -n k3s-master 24.04
multipass info k3s-master
for f in 1 2; do
multipass launch -c 1 -m 1G -d 4G -n k3s-worker-$f 18.04
done
multipass list
multipass exec k3s-master -- bash -c "curl -sfL https://get.k3s.io | sh -"
TOKEN=$(multipass exec k3s-master sudo cat /var/lib/rancher/k3s/server/node-token)
IP=$(multipass info k3s-master | grep IPv4 | awk '{print $2}')
for f in 1 2; do
multipass exec k3s-worker-$f -- bash -c "curl -sfL https://get.k3s.io | K3S_URL=\"https://$IP:6443\" K3S_TOKEN=\"$TOKEN\" sh -"
done
multipass exec k3s-master -- kubectl get nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment