Skip to content

Instantly share code, notes, and snippets.

@RafalSkolasinski
Last active November 18, 2024 20:46
Show Gist options
  • Save RafalSkolasinski/8c62e1ddbb486cf56fcc85783ae5b11b to your computer and use it in GitHub Desktop.
Save RafalSkolasinski/8c62e1ddbb486cf56fcc85783ae5b11b to your computer and use it in GitHub Desktop.
#!/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
@RafalSkolasinski
Copy link
Author

RafalSkolasinski commented Nov 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment