added manual kubernetes clean up script

This commit is contained in:
CodeGit 2026-09-03 22:41:11 +01:00
parent 4ea6d8b9e5
commit 5eb5ea5f25
2 changed files with 20 additions and 1 deletions

16
scripts/cleanup-manual-vm.sh Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Tears down stage 2's throwaway k3s-manual VM (docs/02-k3s.md).
# See docs/04-tofu.md, "Tearing down the manual VM" for what each step does
# and why nothing else needs cleaning up.
set -euo pipefail
read -p "This will destroy the k3s-manual VM and its disks. Continue? [y/N] " confirm
[[ "$confirm" =~ ^[Yy]$ ]] || exit 0
virsh -c qemu:///system destroy k3s-manual 2>/dev/null || true
virsh -c qemu:///system undefine k3s-manual --remove-all-storage 2>/dev/null || true
virsh -c qemu:///system vol-delete --pool default k3s-manual-base.qcow2 2>/dev/null || true
rm -f ~/.kube/config-manual
rm -rf ~/vms
echo "k3s-manual cleaned up."