This repo provides shell scripts to spin up and clean up a local 2-node K3s cluster on Lima.
./create-k3s-cluster.sh creates:
k3s-master(control plane):1 CPU,2GiB RAM,30GiB diskk3s-worker(agent):2 CPU,4GiB RAM,40GiB disk
Both VMs use the template:k3s Lima template and lima:user-v2 network.
lima/limactlkubectl
Verify:
limactl --version
kubectl version --client./create-k3s-cluster.shThe script:
- Starts
k3s-master - Reads the cluster join token from master
- Starts
k3s-workerand joins it to master - Merges the master kubeconfig into
~/.kube/config, removing or replacing any conflictingdefaultentries - Switches
kubectlto thelima-k3scontext and runskubectl get nodes
If you want KUBECONFIG in your current interactive shell, run:
export KUBECONFIG="$HOME/.kube/config"
kubectl get nodes -o wideRemove all Lima VMs (with confirmation):
./cleanup-lima-vms.shRemove all Lima VMs without confirmation:
./cleanup-lima-vms.sh -fShow cleanup help:
./cleanup-lima-vms.sh -h