# Alerts for the disk-reclamation job and the daemons it prunes. # # Context: `forgejo/forgejo-runner-prune` reclaims build cache nightly. Its # own success/failure is invisible unless kube-state-metrics is watched, and # the failure mode it exists to prevent (a full disk on siriussec → DiskPressure # → Forgejo + Postgres evicted, public 503) shows up in node_exporter first. # # What is measurable here: # - node filesystem utilisation per node (node-exporter, all three nodes); # on siriussec the local-path PVs — including the runner's dind data-root — # live on `/`, so this is the DiskPressure precursor and the PVC watchdog # in one series. # - CronJob last-success timestamp and Job failure counters # (kube-state-metrics). # # What is NOT measurable here: kubelet_volume_stats_* does not exist on this # cluster. Verified 2026-10-27: kubelet v1.36.4 exposes # kubelet_volume_metric_collection_duration_seconds but no # kubelet_volume_stats_used_bytes / _capacity_bytes on any node # (`kubectl get --raw /api/v1/nodes//proxy/metrics | grep volume_stats` # is empty, and Prometheus has zero series). So the per-PVC rules below are # written against those metric names but stay inert until a kubelet exports # them; the node-filesystem rules are the live coverage. Per-PVC and per-Docker # -volume sizes are printed by the prune job every night # (`docker system df -v`), which is the record of growth. # # Alertmanager is disabled in this stack (monitoring card), so these surface in # Prometheus → Alerts and Grafana → Alerting. No external receiver is added. apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: forgejo-prune namespace: monitoring labels: release: kube-prometheus-stack spec: groups: - name: forgejo-prune rules: - alert: ForgejoPruneCronJobStale # 04:17 UTC nightly; 26 h leaves room for one missed tick before it # pages a human. `or absent(...)` catches the job being deleted or # never having succeeded at all. expr: | ( time() - kube_cronjob_status_last_successful_time{namespace="forgejo", cronjob="forgejo-runner-prune"} > 26 * 3600 ) or absent(kube_cronjob_status_last_successful_time{namespace="forgejo", cronjob="forgejo-runner-prune"}) for: 10m labels: severity: warning annotations: summary: >- forgejo-runner-prune has not completed successfully in over 26 h description: >- Build cache, exited containers and unused images are not being reclaimed on the Pi host daemon or on the dind daemons. Check `kubectl -n forgejo get jobs -l role=prune` and the pod logs of the newest Job; the job skips (exit 0) when a build is live, but a *stale* success means it has not run at all. Force one run: kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s) - alert: ForgejoPruneJobFailed # kube_job_failed was removed from kube-state-metrics; the supported # series is kube_job_status_failed (0 for a successful job, >0 when a # pod failed). Only the most recent jobs are kept in Prometheus, so a # transient failure ages out on its own after the history limit. expr: | max by (job_name) ( kube_job_status_failed{namespace="forgejo", job_name=~"forgejo-runner-prune-.*"} ) > 0 for: 5m labels: severity: warning annotations: summary: forgejo-runner-prune Job {{ $labels.job_name }} has a failed pod description: >- A prune run failed (or its dind discovery/exec container did). Read `kubectl -n forgejo logs job/{{ $labels.job_name }} -c dind-daemons` — a failure there means a running dind daemon was not reachable over the exec API, so that daemon is growing unpruned. One retry is allowed by backoffLimit; persistent failures need the RBAC or the pod checked. # Per-PVC rules: correct expressions, currently inert (see the header — # this cluster's kubelet exports no kubelet_volume_stats_* series). They # start working the day that comes back, and they cost nothing until # then. Coverage today is NodeFilesystemFillingUp on siriussec, where # every local-path PV physically lives. - alert: RunnerDindPvcHighWatermark expr: | max by (namespace, persistentvolumeclaim) ( kubelet_volume_stats_used_bytes{namespace="forgejo", persistentvolumeclaim=~"forgejo-runner-.*"} ) / max by (namespace, persistentvolumeclaim) ( kubelet_volume_stats_capacity_bytes{namespace="forgejo", persistentvolumeclaim=~"forgejo-runner-.*"} ) > 0.85 for: 15m labels: severity: warning annotations: summary: >- dind PVC {{ $labels.persistentvolumeclaim }} is over 85% full description: >- The image/build-cache/volume footprint on this runner's dind daemon is approaching the 20Gi PVC. Inspect it with `kubectl -n forgejo exec -c dind -- docker system df -v`; the nightly prune caps build cache but never deletes named volumes. - alert: RunnerDindPvcCritical expr: | max by (namespace, persistentvolumeclaim) ( kubelet_volume_stats_used_bytes{namespace="forgejo", persistentvolumeclaim=~"forgejo-runner-.*"} ) / max by (namespace, persistentvolumeclaim) ( kubelet_volume_stats_capacity_bytes{namespace="forgejo", persistentvolumeclaim=~"forgejo-runner-.*"} ) > 0.95 for: 5m labels: severity: critical annotations: summary: >- dind PVC {{ $labels.persistentvolumeclaim }} is over 95% full description: >- Builds will start failing with ENOSPC. Scale the runner to 0, raise the PVC, or clear the dind data-root deliberately (see the DiskPressure runbook in the home-k8s skill) — do not wipe it while the runner pod is up. - name: dind-disk-cap rules: # Pi-specific cap, added with the arm64 dind cutover (kanban # t_0da0a1cc). The two arm64 runners now hold 240 GiB of dind PVCs # (200Gi shared + 40Gi deploy) on rpi's single root filesystem, which # is the same disk the kubelet lives on. A static hostPath PV does NOT # enforce its claim, and the `RunnerDindPvc*` rules cannot fire for it # (no kubelet_volume_stats_* series on this cluster), so this node # filesystem rule is the real growth cap: 70 % of 917 G leaves ~275 G, # i.e. reachable while there is still room to run the prune job. # `NodeFilesystemFillingUp` below stays at 85 % as the backstop. - alert: RpiDindDataRootFillingUp expr: | ( 1 - ( node_filesystem_avail_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs", instance=~"10.10.0.1:.*"} / node_filesystem_size_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs", instance=~"10.10.0.1:.*"} ) ) * on (instance) group_left (nodename) node_uname_info{nodename="rpi"} > 0.70 for: 30m labels: severity: warning annotations: summary: >- rpi root filesystem is {{ $value | humanizePercentage }} full (dind CI data-roots live here) description: >- The arm64 runners' dind data-roots (PVCs forgejo-runner-arm64-dind 200Gi and forgejo-runner-deploy-arm64-dind 40Gi) share rpi's only filesystem with the kubelet. Nothing enforces those claim sizes. Attribute the growth with `kubectl -n forgejo exec -c dind -- docker system df -v` (the nightly prune job prints this for every daemon and never deletes named volumes), then reclaim with `kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)`. See docs/arm64-runner-dind.md §4.4. - name: disk-capacity rules: - alert: NodeFilesystemFillingUp # Root filesystem per node, named by hostname rather than IP so the # alert is actionable. 85% is where kubelet's imagefs/nodefs GC and # the DiskPressure taint start to matter on siriussec; the Pi's # Docker volumes (169 GB of CI caches) live here too. expr: | ( 1 - ( node_filesystem_avail_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} / node_filesystem_size_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} ) ) * on (instance) group_left (nodename) node_uname_info > 0.85 for: 30m labels: severity: warning annotations: summary: "{{ $labels.nodename }} root filesystem is {{ $value | humanizePercentage }} full" description: >- Reclaim with `kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)` (it prunes the Pi host daemon and every dind daemon), and read that job's `docker system df -v` output for the volumes that are growing. At 85% kubelet starts evicting on siriussec — that is the Forgejo 503 failure mode. - alert: NodeFilesystemCritical expr: | ( 1 - ( node_filesystem_avail_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} / node_filesystem_size_bytes{mountpoint="/", fstype=~"ext4|xfs|btrfs"} ) ) * on (instance) group_left (nodename) node_uname_info > 0.92 for: 10m labels: severity: critical annotations: summary: "{{ $labels.nodename }} root filesystem is {{ $value | humanizePercentage }} full" description: >- DiskPressure is imminent/immediate. Free space before the next build: prune now, then check `docker system df -v` on that host for the named volume that grew (never delete named volumes blind — onionwire-target-ci and the Android SDK/Gradle caches are shared CI state).