# 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 closest thing # to a PVC watchdog this cluster can have (runner-scoped rules below). # - CronJob last-success timestamp and Job failure counters # (kube-state-metrics). # # What is NOT measurable here — per-PVC bytes. kubelet_volume_stats_* was an # ALPHA metric set served from kubelet's /metrics/volumes endpoint; that # endpoint is gone in this cluster's kubelet. Verified 2026-10-27 on kubelet # v1.36.4: `https://:10250/metrics/volumes` returns **404 on all three # nodes** (10.10.0.2 / 10.10.0.1 / 10.10.0.5) while /metrics, /metrics/probes, # /metrics/cadvisor and /metrics/resource return 200, `/metrics` contains no # kubelet_volume_stats_* series at all, and Prometheus has zero series for # either name. This is the upstream loss of the alpha volume-stats metrics in # kubelet 1.34 (kubernetes/kubernetes#133847, regression fix #133890), not a # hostPath/PVC-type quirk and not something a scrape config can bring back: # there is no endpoint left to scrape, and re-deriving it would mean a new # exporter parsing kubelet's /stats/summary JSON (new Deployment + nodes/stats # RBAC) — out of proportion for a three-node lab. So: no alert here selects a # metric that does not exist. Coverage is the node filesystem that actually # holds the data: `RunnerDindDisk*` below (runner-scoped, 80/90 %, every node # running a runner except rpi), `RpiDindDataRootFillingUp` in group # `dind-disk-cap` (rpi, 70 %, because its 240 GiB of dind PVCs sit on a 917 G # disk) and the generic `disk-capacity` group (85/92 %). Per-PVC and # per-Docker-volume sizes are still printed by the prune job every night # (`docker system df -v`) — that output 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. # Runner-scoped filesystem rules: this is the honest replacement for the # old per-PVC pair (kubelet_volume_stats_* has no producer — header). # They measure the filesystem that actually backs the dind data-root, on # the nodes that actually run a forgejo-runner pod. On siriussec that is # /opt/local-path-provisioner/pvc-*_forgejo_forgejo-runner-amd64 (dind's # /var/lib/docker) on the root ext4. # Scoping by *pod* rather than by PVC name is deliberate: the PVCs are # shared-filesystem consumers, arm64 dind PVCs are covered the moment # their runner pod is scheduled, and nodes that run no runner (linode) do # not duplicate the generic disk-capacity group. # rpi is deliberately excluded (nodename!="rpi"): it carries 240 GiB of # dind PVCs on a 917 G disk, so 80 % (~734 G) would be far too late to run # the prune job. Group `dind-disk-cap` holds its tighter 70 % cap # (RpiDindDataRootFillingUp). Two rules, two disks, no double page. # Thresholds here are 5 points tighter than NodeFilesystemFillingUp / # Critical so CI fill is reported as CI fill, with the runner runbook. - alert: RunnerDindDiskHighWatermark 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{nodename!="rpi"} ) and on (nodename) label_replace( max by (node) (kube_pod_info{namespace="forgejo", pod=~"forgejo-runner-.*"}), "nodename", "$1", "node", "(.+)" ) ) > 0.80 for: 30m labels: severity: warning annotations: summary: >- {{ $labels.nodename }} is {{ $value | humanizePercentage }} full — the filesystem carrying this node's Forgejo runner dind data-root description: >- A forgejo-runner pod runs on {{ $labels.nodename }}, and the dind data-root lives under /opt/local-path-provisioner on this node's root filesystem, so CI images, build cache and named volumes fill the same disk as Forgejo/Postgres (siriussec) or the host Docker daemon (rpi). Per-PVC bytes cannot be measured here — kubelet 1.34+ no longer exports kubelet_volume_stats_* and /metrics/volumes is 404 — so this node-level rule is the guard. Inspect the offenders: `kubectl -n forgejo exec -c dind -- docker system df -v` and `du -sh /opt/local-path-provisioner/pvc-*` on the node, then let the nightly prune reclaim (or force it: kubectl -n forgejo create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)). - alert: RunnerDindDiskCritical 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{nodename!="rpi"} ) and on (nodename) label_replace( max by (node) (kube_pod_info{namespace="forgejo", pod=~"forgejo-runner-.*"}), "nodename", "$1", "node", "(.+)" ) ) > 0.90 for: 10m labels: severity: critical annotations: summary: >- {{ $labels.nodename }} is {{ $value | humanizePercentage }} full — runner builds will fail with ENOSPC description: >- DiskPressure is imminent on a node running CI: kubelet starts evicting (Forgejo + pg-1 went Pending on siriussec this way) and dind builds fail with "no space left on device". Act now: scale the runner to 0 (`kubectl -n forgejo scale deploy/ --replicas=0`), force the prune, and only then clear the dind data-root by hand (`/opt/local-path-provisioner/pvc-*_forgejo_forgejo-runner-*/` on the node) — never wipe it while the runner pod is up. The 20Gi PVC request does not cap the directory: local-path PVs are plain directories, so the filesystem fills first. - 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 per-PVC usage cannot be alerted on at all # (kubelet 1.34+ exports no kubelet_volume_stats_*, header), 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).