Bug: Prevent Longhorn disks filling up after node outages #39

Merged
kasun merged 1 commits from bug/longhorn-storage-exhaustion into main 2026-11-21 15:52:36 +01:00

Why

Node outages left orphaned replica data on the longhorn-extra disks. Together with a 20 GB snapshot, this left no room for a second Prometheus replica. The volume ran on one replica and faulted when that replica failed.

What changes on merge

  • Longhorn deletes orphaned replica data and instances automatically.
  • A daily snapshot-cleanup job runs at 03:30 and a daily filesystem-trim job at 04:30, both for volumes in the default group.
  • The minimum free space per disk drops from 25% to 10%, as Longhorn recommends for dedicated disks.
  • defaultReplicaCount goes from 2 to 3 to match the StorageClass. This only affects volumes created in the Longhorn UI. Existing volumes do not change.

Verification

npm run typecheck passes. pulumi preview shows 2 to create, 1 to update, 26 unchanged. The preview does not render the Helm chart, so check the live values after deploy:

kubectl get settings.longhorn.io -n longhorn-system default-replica-count orphan-resource-auto-deletion storage-minimal-available-percentage
kubectl get recurringjobs.longhorn.io -n longhorn-system

Expected: {"v1":"3","v2":"3"}, replica-data;instance, 10, and both jobs listed.

Not included

Backups to TrueNAS NFS are planned separately.

## Why Node outages left orphaned replica data on the `longhorn-extra` disks. Together with a 20 GB snapshot, this left no room for a second Prometheus replica. The volume ran on one replica and faulted when that replica failed. ## What changes on merge - Longhorn deletes orphaned replica data and instances automatically. - A daily `snapshot-cleanup` job runs at 03:30 and a daily `filesystem-trim` job at 04:30, both for volumes in the `default` group. - The minimum free space per disk drops from 25% to 10%, as Longhorn recommends for dedicated disks. - `defaultReplicaCount` goes from 2 to 3 to match the StorageClass. This only affects volumes created in the Longhorn UI. Existing volumes do not change. ## Verification `npm run typecheck` passes. `pulumi preview` shows 2 to create, 1 to update, 26 unchanged. The preview does not render the Helm chart, so check the live values after deploy: ```bash kubectl get settings.longhorn.io -n longhorn-system default-replica-count orphan-resource-auto-deletion storage-minimal-available-percentage kubectl get recurringjobs.longhorn.io -n longhorn-system ``` Expected: `{"v1":"3","v2":"3"}`, `replica-data;instance`, `10`, and both jobs listed. ## Not included Backups to TrueNAS NFS are planned separately.
claude-bot Bot added 1 commit 2026-11-21 15:49:42 +01:00
bug(k8s-infra): prevent Longhorn disks filling up after node outages
Deploy k8s Infra / Pulumi Deploy (pull_request) Skipped
Deploy k8s Infra / Pulumi Preview (pull_request) Successful in 51s
ff2b565677
Orphaned replica data and a large snapshot left no room for a second Prometheus replica, so the volume faulted when its only replica failed. Clean up orphans and system snapshots, trim volumes daily, and lower the free-space reserve to 10% because longhorn-extra is a dedicated disk. Align the UI default with the StorageClass at 3 replicas so volumes keep two copies during a node reboot.
kasun merged commit b04ab52fd2 into main 2026-11-21 15:52:36 +01:00
Sign in to join this conversation.