From 327c07314c08d2652cc26ce55a8f0d1d0b6e9c96 Mon Sep 17 00:00:00 2001 From: MichaelFisher1997 Date: Sat, 28 Feb 2026 21:24:16 +0000 Subject: [PATCH 1/2] fix: reclaim remote nix store space before rebuild --- nixos/kubeadm/modules/k8s-common.nix | 6 ++++++ nixos/kubeadm/scripts/rebuild-and-bootstrap.sh | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/nixos/kubeadm/modules/k8s-common.nix b/nixos/kubeadm/modules/k8s-common.nix index 449ee98..97e2aed 100644 --- a/nixos/kubeadm/modules/k8s-common.nix +++ b/nixos/kubeadm/modules/k8s-common.nix @@ -60,6 +60,12 @@ in }; nix.settings.trusted-users = [ "root" "micqdf" ]; + nix.gc = { + automatic = true; + dates = "daily"; + options = "--delete-older-than 3d"; + }; + nix.settings.auto-optimise-store = true; environment.variables = { KUBECONFIG = "/etc/kubernetes/admin.conf"; diff --git a/nixos/kubeadm/scripts/rebuild-and-bootstrap.sh b/nixos/kubeadm/scripts/rebuild-and-bootstrap.sh index 55dd510..8d35378 100755 --- a/nixos/kubeadm/scripts/rebuild-and-bootstrap.sh +++ b/nixos/kubeadm/scripts/rebuild-and-bootstrap.sh @@ -141,6 +141,14 @@ prepare_remote_nix_trust() { remote "$node_ip" "sudo systemctl restart nix-daemon 2>/dev/null || true" } +prepare_remote_space() { + local node_ip="$1" + echo "==> Reclaiming disk space on $node_ip" + remote "$node_ip" "sudo nix-collect-garbage -d || true" + remote "$node_ip" "sudo nix store gc || true" + remote "$node_ip" "sudo rm -rf /tmp/nix* /tmp/nixos-rebuild* || true" +} + populate_nodes prepare_known_hosts export NIX_SSHOPTS="$SSH_OPTS" @@ -155,11 +163,13 @@ detect_ssh_user "$PRIMARY_CP_IP" for node in "${CP_NAMES[@]}"; do prepare_remote_nix_trust "${NODE_IPS[$node]}" + prepare_remote_space "${NODE_IPS[$node]}" rebuild_node "$node" "${NODE_IPS[$node]}" done for node in "${WK_NAMES[@]}"; do prepare_remote_nix_trust "${NODE_IPS[$node]}" + prepare_remote_space "${NODE_IPS[$node]}" rebuild_node "$node" "${NODE_IPS[$node]}" done From 824e3c09d138de50ea90af0c47c873586fa089e7 Mon Sep 17 00:00:00 2001 From: MichaelFisher1997 Date: Sat, 28 Feb 2026 21:25:44 +0000 Subject: [PATCH 2/2] update: increase VM disk sizes for kubeadm nodes --- terraform/terraform.tfvars | 4 ++-- terraform/variables.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/terraform.tfvars b/terraform/terraform.tfvars index 36d8f09..87ca229 100644 --- a/terraform/terraform.tfvars +++ b/terraform/terraform.tfvars @@ -12,8 +12,8 @@ worker_vmid_start = 711 control_plane_cores = 1 control_plane_memory_mb = 4096 -control_plane_disk_size = "40G" +control_plane_disk_size = "80G" worker_cores = [4, 4, 4] worker_memory_mb = [12288, 12288, 12288] -worker_disk_size = "60G" +worker_disk_size = "120G" diff --git a/terraform/variables.tf b/terraform/variables.tf index b77eab8..91ebd27 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -77,13 +77,13 @@ variable "worker_memory_mb" { variable "control_plane_disk_size" { type = string - default = "40G" + default = "80G" description = "Disk size for control plane VMs" } variable "worker_disk_size" { type = string - default = "60G" + default = "120G" description = "Disk size for worker VMs" }