Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
multipass + k3s
multipass launch --name k3s-master --cpus 1 --mem 2048M --disk 5G && \
multipass launch --name k3s-node1 --cpus 1 --mem 2048M --disk 15G && \
multipass launch --name k3s-node2 --cpus 1 --mem 2048M --disk 15G && \
multipass exec k3s-master -- /bin/bash -c "curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -" && \
export K3S_TOKEN="$(multipass exec k3s-master -- /bin/bash -c "sudo cat /var/lib/rancher/k3s/server/node-token")" && \
export K3S_IP_SERVER="https://$(multipass info k3s-master | grep "IPv4" | awk -F' ' '{print $2}'):6443" && \
multipass exec k3s-node1 -- /bin/bash -c "curl -sfL https://get.k3s.io | K3S_TOKEN=${K3S_TOKEN} K3S_URL=${K3S_IP_SERVER} sh -" && \
multipass exec k3s-node2 -- /bin/bash -c "curl -sfL https://get.k3s.io | K3S_TOKEN=${K3S_TOKEN} K3S_URL=${K3S_IP_SERVER} sh -" && \
multipass exec k3s-master -- /bin/bash -c "cat /etc/rancher/k3s/k3s.yaml" | sed "s%https://127.0.0.1:6443%${K3S_IP_SERVER}%g" | sed "s/default/k3s/g" > ~/.kube/k3s.yaml && \
export KUBECONFIG=~/.kube/k3s.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment