Last active
November 18, 2024 20:46
-
-
Save RafalSkolasinski/8c62e1ddbb486cf56fcc85783ae5b11b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
set -o xtrace | |
VM_NAME="${1:-k3s}" | |
limactl start --name ${VM_NAME} --vm-type=vz --network vzNAT template://ubuntu-lts | |
limactl shell ${VM_NAME} sudo apt-get update | |
limactl shell ${VM_NAME} sudo apt-get install avahi-daemon --yes | |
limactl shell ${VM_NAME} sudo systemctl enable --now avahi-daemon | |
limactl shell ${VM_NAME} sh -c "curl -sfL https://get.k3s.io | sh -s - --disable servicelb --disable traefik --tls-san lima-${VM_NAME}.local" | |
SSH_FILE=$(limactl ls --format='{{.SSHConfigFile}}' ${VM_NAME}) | |
ssh -F ${SSH_FILE} lima-${VM_NAME} sudo cat /etc/rancher/k3s/k3s.yaml | kube-config-merge --name lima-${VM_NAME} --server https://lima-${VM_NAME}.local:6443 --override |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Short snippet that creates K3s inside Lima VM.
This mimc running k3s on bare metal server.
For any application development kind / minikube is better solution.
Requires: https://github.com/RafalSkolasinski/kube-config-merge