monitoring: replace the dead kubelet_volume_stats alerts with runner-scoped disk rules

kubelet_volume_stats_* was an ALPHA metric set served from kubelet's
/metrics/volumes endpoint; that endpoint returns 404 on every node of this
cluster (kubelet v1.36.4 — upstream loss in 1.34, kubernetes#133847), and
/metrics carries no volume-stats series. RunnerDindPvcHighWatermark and
RunnerDindPvcCritical therefore could never fire while showing as healthy.

Per-PVC bytes are not measurable here and no scrape config can change that,
so the pair is replaced by RunnerDindDiskHighWatermark (80%) and
RunnerDindDiskCritical (90%): root-filesystem usage on nodes that actually
run a forgejo-runner pod, which is the filesystem holding the dind data-root
under /opt/local-path-provisioner. New arm64 dind PVCs are covered as soon
as their runner is scheduled; nodes without runners (linode) do not
duplicate the generic disk-capacity group.

Also corrects the cause in docs, the dashboard notes and the prune CronJob
comment (it is not a hostPath quirk, the endpoint is gone).
This commit is contained in:
Lance Walters 2026-10-27 02:05:57 -04:00
commit e572f84b0b
8 changed files with 145 additions and 80 deletions

View file

@ -8,21 +8,31 @@
# 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.
# 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: 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/<node>/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.
# 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://<node>: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.
@ -81,60 +91,102 @@ spec:
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
# 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: |
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
(
(
(
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: >-
dind PVC {{ $labels.persistentvolumeclaim }} is over 85% full
{{ $labels.nodename }} is {{ $value | humanizePercentage }} full —
the filesystem carrying this node's Forgejo runner dind data-root
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 <runner-pod> -c dind -- docker system df -v`;
the nightly prune caps build cache but never deletes named
volumes.
- alert: RunnerDindPvcCritical
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 <runner-pod> -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: |
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
(
(
(
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: >-
dind PVC {{ $labels.persistentvolumeclaim }} is over 95% full
{{ $labels.nodename }} is {{ $value | humanizePercentage }} full —
runner builds will fail with ENOSPC
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.
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/<runner> --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 the `RunnerDindPvc*` rules cannot fire for it
# (no kubelet_volume_stats_* series on this cluster), so this node
# 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.