From 33be713d0ceb7463c4071dc9157843582295026c Mon Sep 17 00:00:00 2001 From: Michal Date: Fri, 14 Aug 2026 23:22:14 +0100 Subject: [PATCH] feat(bastion): size the rancher LV at 120G for k8s roles in kickstart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 20G /var/lib/rancher LV (k3s imageFs) idled at 85% used from steady-state images alone; one ~5G image pull tripped imagefs eviction and evicted unrelated pods (2026-08-14 DiskPressure incident). Create the LV for both worker and infra roles at 120G — it must be sized here because longhorn's --grow consumes all remaining VG space, making post-install lvextend impossible. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_017f6jyeeDqP4ufyeL3UER9w --- bastion/src/bastion/src/templates/install.ks.ts | 11 ++++++++--- bastion/src/bastion/tests/kickstart.test.ts | 14 +++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/bastion/src/bastion/src/templates/install.ks.ts b/bastion/src/bastion/src/templates/install.ks.ts index 94af999..87229cf 100644 --- a/bastion/src/bastion/src/templates/install.ks.ts +++ b/bastion/src/bastion/src/templates/install.ks.ts @@ -40,6 +40,11 @@ export function renderInstallKickstart(params: InstallKickstartParams): string { const now = new Date().toISOString(); const hasLonghorn = role === "worker"; const hasRancher = role === "infra"; + // k8s roles get a dedicated 120G image-store LV. 2026-08 incident: the old + // 20G LV idled at 85% used, so a single ~5G image pull tripped imagefs + // eviction. Must be sized here — longhorn's --grow consumes all remaining + // VG space, making post-install lvextend impossible on worker nodes. + const hasRancherLv = role === "infra" || role === "worker"; const isVanilla = role === "vanilla"; // -- Auth section -- @@ -113,9 +118,9 @@ done ? `logvol /var/lib/longhorn --vgname=${vg} --name=longhorn --fstype=xfs --grow --size=1` : ""; - // -- Rancher LV for fresh install (infra role) -- - const rancherFreshLine = hasRancher - ? `logvol /var/lib/rancher --vgname=${vg} --name=rancher --fstype=xfs --size=20480` + // -- Rancher LV for fresh install (k8s roles: worker + infra) -- + const rancherFreshLine = hasRancherLv + ? `logvol /var/lib/rancher --vgname=${vg} --name=rancher --fstype=xfs --size=122880` : ""; return `# Lab Bastion -- Fedora ${fedoraVersion} server install diff --git a/bastion/src/bastion/tests/kickstart.test.ts b/bastion/src/bastion/tests/kickstart.test.ts index 771f5d1..5a5dada 100644 --- a/bastion/src/bastion/tests/kickstart.test.ts +++ b/bastion/src/bastion/tests/kickstart.test.ts @@ -96,9 +96,9 @@ describe("renderInstallKickstart", () => { expect(ks).toContain("/api/progress"); }); - it("infra role has /var/lib/rancher partition", () => { + it("infra role has 120G /var/lib/rancher partition", () => { const ks = renderInstallKickstart(baseParams({ role: "infra" })); - expect(ks).toContain("logvol /var/lib/rancher --vgname=labvg --name=rancher --fstype=xfs --size=20480"); + expect(ks).toContain("logvol /var/lib/rancher --vgname=labvg --name=rancher --fstype=xfs --size=122880"); }); it("infra role has k3s install", () => { @@ -106,10 +106,14 @@ describe("renderInstallKickstart", () => { expect(ks).toContain("curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true sh -"); }); - it("worker role does NOT have /var/lib/rancher partition in fresh install", () => { + it("worker role has 120G /var/lib/rancher partition (imageFs must be sized before longhorn --grow)", () => { const ks = renderInstallKickstart(baseParams({ role: "worker" })); - // Worker should not have the fresh-install rancher partition line - expect(ks).not.toContain("logvol /var/lib/rancher --vgname=labvg --name=rancher --fstype=xfs --size=20480"); + expect(ks).toContain("logvol /var/lib/rancher --vgname=labvg --name=rancher --fstype=xfs --size=122880"); + }); + + it("vanilla role does NOT have /var/lib/rancher partition in fresh install", () => { + const ks = renderInstallKickstart(baseParams({ role: "vanilla" })); + expect(ks).not.toContain("--name=rancher --fstype=xfs"); }); it("worker role does NOT have k3s install", () => {