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 - Exports
KUBECONFIGfor the master kubeconfig path (for the current shell process) - Runs
kubectl get nodes
If you want KUBECONFIG in your current interactive shell, run:
export KUBECONFIG="$(limactl list k3s-master --format '{{.Dir}}/copied-from-guest/kubeconfig.yaml')"
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