Commit graph homek8s/monitoring/controllers/home
Author SHA1 Message Date
Lance Walters
c2eb2b2fa3 monitoring: suppress the dead kubelet_volume_stats rules in kubernetes-storage
kube-prometheus-stack's kubernetes-storage group ships five rules; four of
them (both severities of KubePersistentVolumeFillingUp and of
KubePersistentVolumeInodesFillingUp) select kubelet_volume_stats_*. Those
series have no producer here: kubelet v1.36.4 404s on /metrics/volumes on all
three nodes (404s since kubelet 1.34, kubernetes/kubernetes#133847) and
count(kubelet_volume_stats_used_bytes) returns 0 series. The rules loaded fine
and reported health=ok/active=false, which reads as 'no PVC is filling' when
nothing can ever fire.

Disabled per rule via defaultRules.disabled (not by dropping the group): the
group's fifth alert, KubePersistentVolumeErrors, uses kube-state-metrics'
kube_persistentvolume_status_phase, which is live (40 series), so it stays.

Verified by rendering the chart with these values: group kubernetes-storage
now contains exactly one rule.
2026-10-27 02:22:46 -04:00
Lance Walters
af73b261b3 monitoring: name the dind data-root precisely in the runner disk alert 2026-10-27 02:13:11 -04:00
Lance Walters
e572f84b0b 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).
2026-10-27 02:07:07 -04:00
Lance Walters
131b9bc7c9 forgejo runners(arm64): run both arm64 runners as in-cluster dind pods
The Pi's host Docker is no longer the arm64 job-container daemon. Both
forgejo-runner-arm64 and forgejo-runner-deploy-arm64 now run a privileged
docker:27-dind sidecar (--mtu=1420, socket on an emptyDir shared with the
runner, data-root on a PVC), the same shape as forgejo-runner-amd64.

- labels preserved verbatim: shared keeps docker-arm64/arm64/docker, deploy
  keeps deploy-arm64 only; capacity 1 on both
- runner.ini moved from hostPath to the data PVC by copy, uuid preserved
  (4e07c1e9... / a41aad73...); the deploy runner's register init container is
  inverted into a guard so a missing file cannot burn a token and create a
  second runner
- dind limits.memory 4Gi (measured peak 3.10GiB) and 2Gi for the deploy runner
  so a CI run and a deploy cannot both claim the Pi's 7GiB
- static hostPath PVs pinned to rpi with Retain: dynamic local-path cannot
  provision there (helper pod hardcoded to siriussec)
- docker CLI/buildx come from the dind image instead of the host's docker-static
- Pi registry additionally published on 10.10.0.1:5000 (out of band on the Pi)
- RpiDindDataRootFillingUp at 70%: the real cap, since a static PV does not
  enforce its claim and kubelet_volume_stats_* does not exist here

Design and measured proof: docs/arm64-runner-dind.md (t_627c231c).
2026-10-27 02:03:11 -04:00
Lance Walters
f1fcf21a94 forgejo/prune: prune every Docker daemon, cap builder cache by age, alert on growth
The nightly CronJob reported Complete while never reclaiming build cache:
docker 27/buildx 0.20.1 accepts --keep-storage and --max-used-space but
returns 'Total: 0B' for both (measured: 21.44GB cache with a 20GB cap, and
541MB cache with a 100MB cap). The comment claiming 53GB reclaimed was true
on an older CLI and is now false. --filter until= does reclaim, so the cash
cap is enforced by walking age windows down (72h -> 0s) and stopping as soon
as the cache is under the cap.

Coverage is now every daemon, discovered not listed: the Pi host socket and
every in-cluster dind pod matching label app=forgejo-runner with a dind
container, pruned over pods/exec with a namespace-scoped ServiceAccount, so
the arm64 dind migration is picked up without editing this job.

Busy guard skips a daemon with a live build and still exits 0. Named volumes
are never pruned; their sizes are printed every run. Adds PrometheusRule
forgejo-prune: cronjob staleness/failure plus node filesystem high-watermark.
2026-10-27 01:43:20 -04:00
Lance Walters
e63af123c5 dashboards: zero-render stats, drop the aspirational folder annotation, keep the validator in the repo
- every count-style stat that can legitimately have no series now ends in
  'or vector(0)', so an empty result renders 0 instead of 'No data' (that bit
  the Pending-pods stat the moment the one Pending pod went away)
- no grafana_folder annotation: the sidecar's API reload 401s (Grafana's live
  admin password is the out-of-band one; the Secret is the first-boot seed), so
  the dashboards are imported by Grafana's file provider, which has no
  per-dashboard folder option and puts them in General. The annotation described
  a path the boards never take.
- validate_panels.py lives next to build.py: reads the panel PromQL out of the
  provisioned ConfigMap and queries Prometheus, so 'every panel returns data' is
  a command, not a claim. 55/55 targets pass.
2026-10-27 01:40:15 -04:00
Lance Walters
28632e61c6 dashboards: fix runner pod selector and custom-metric labels after panel validation
Panel validation against the live Prometheus API caught three real faults:
- pod=~"forgejo-runner-.*" also matched the forgejo-runner-prune-* CronJob pods,
  which are Completed and permanently not-Ready, so the not-Ready stat read 3.
- CNPG custom-query metrics carry namespace/pod from the scrape, not the
  exporter's cluster label, so cluster="pg" matched nothing (empty panels).
- a missing paren in the memory-working-set expression (HTTP 400 from Prometheus).

Also make two legitimately-empty stats render a hard 0 (or vector(0)) instead of
'No data': not-Ready runner pods, and nodes with DiskPressure.

55/55 panel targets now return non-empty results.
2026-10-27 01:36:02 -04:00
Lance Walters
9e851f4dfe monitoring: custom Forgejo runner, CNPG and workload dashboards from git
Dashboards (uid forgejo-runners, cnpg-postgres, home-lab-workloads) live as
ConfigMaps generated from monitoring/controllers/home/dashboards/build.py and are
loaded by the kube-prometheus-stack grafana sidecar.

Postgres was not scraped at all before this: add a hand-written PodMonitor per
CNPG cluster (release=kube-prometheus-stack, which is what this Prometheus's
podMonitorSelectorNilUsesHelmValues default requires) plus
spec.monitoring.customQueriesConfigMap on both Clusters. enablePodMonitor stays
false — deprecated in CNPG 1.27 and it gives no control over labels.

pg-actions-queries.yaml adds the Forgejo Actions queue/outcome/last_online
metrics that only the forgejo database can answer.

prometheus-node-exporter is no longer pinned to siriussec: the arm64 runner's
jobs are host containers on rpi, so the Pi's root filesystem is the disk that
matters there and kubelet cannot see it.

docs/monitoring-dashboards.md documents the PromQL, the exporter GRANT and the
known unknowns (arm64 per-job breakdown, hostPath PVs have no kubelet volume
stats, single-instance replication, no backups).
2026-10-27 01:32:20 -04:00
Lance Walters
5c7fbfefa8 internal gateway probe: alert when the gateway label is not on exactly one node
The probe catches the symptom; this catches the cause. kube-state-metrics
exposes role labels as kube_node_role, so no extra scrape target is needed.
2026-10-27 01:08:53 -04:00
Lance Walters
53e85ca6e4 docs: Grafana persistence + admin-password ownership and recovery path
Records what now persists (sqlite DB on a 5Gi local-path PVC, pinned
GF_SECURITY_SECRET_KEY), that provisioned dashboards still win over UI edits,
that the Secret is only the first-boot seed (the DB owns the password after
that), the reset-admin-password recovery path, and the one-off rollingUpdate
patch the Recreate transition needed.
2026-10-27 01:04:12 -04:00
Lance Walters
48b2b6ac01 internal gateway: single serving address (siriussec only) + a probe that notices when it flaps
rpi carried node-role.kubernetes.io/gateway=true, so cilium-envoy bound 8080/8081/8084
there too. Its Envoy completes TCP to a backend pod on siriussec but never finishes
the request: every hit on 10.10.0.1:8081/8084 hung 5s and returned 503, even from the
Pi own 127.0.0.1, while 10.10.0.2 answered in ms. Clients that tried either address
saw the dashboards flap. Remove the label from rpi: one gateway node, one address.

The Gateway status.addresses still lists every node InternalIP (cilium#29060 ignores
spec.addresses) - it is not a VIP; only 10.10.0.2 serves.

Add blackbox-exporter + Probe (8081, 8084 every 30s) + PrometheusRule alerts so a
regression is visible in the stack instead of on a phone. Give the internal_gw nft
accept rules counters so an allowed request is provable.
2026-10-27 00:57:39 -04:00
Lance Walters
8293df123f grafana: null out rollingUpdate with the Recreate strategy
The existing Deployment still owns strategy.rollingUpdate from the previous
release; omitting it in SSA does not drop it and Helm fails the upgrade.
2026-10-27 00:55:28 -04:00
Lance Walters
cc8ce74746 grafana: persist /var/lib/grafana on a 5Gi local-path PVC + pin GF_SECURITY_SECRET_KEY
In-app admin password changes and session state died with every pod because the
sqlite DB was container-local and secret_key regenerated on each boot (clients
bounced on / with 'user token not found'). Recreate strategy is required: a RWO
local-path PVC cannot be mounted by old+new pod during a rolling update.

Secret monitoring/grafana-secret-key is out of band, key secret_key.
2026-10-27 00:53:29 -04:00
Lance Walters
8939cbdd78 grafana: serve it on the bare WireGuard IP (drop HTTPRoute hostnames)
A phone cannot edit /etc/hosts, so it sends Host: 10.10.0.2:8081, matches no
.lab.internal route and gets a 404 from Envoy. With no hostnames on the route
any Host on the internal listener matches, so http://10.10.0.2:8081/ serves
Grafana and the named URL keeps working. Port 8081 stays Grafana-only; docs now
state the bare-IP rule and the phone-path tests.
2026-10-27 00:35:53 -04:00
Lance Walters
d3741df619 monitoring: kube-prometheus-stack + WireGuard-only Grafana via the internal gateway
- clusters/homek8s/monitoring.yaml: the 'monitoring' Flux Kustomization was
  declared only under clusters/home, which the bootstrapped flux-system
  Kustomization never reads (its path is ./clusters/homek8s), so it had never
  been created. Declare it in the tree that actually reconciles.
- monitoring/controllers/home: HelmRepository + HelmRelease (chart pinned
  92.14.0), values.yaml via configMapGenerator, Grafana admin from the
  monitoring/grafana-admin Secret (out of band, never in git).
- Everything pinned to siriussec, Prometheus on a 10Gi local-path PVC with
  7d AND 8GB retention caps; alertmanager off; no remote write.
- internal gateway listener now accepts routes from any namespace; the security
  boundary is the host firewall, not the namespace.
- host-firewall/: nft table + oneshot unit for siriussec and the ufw script for
  rpi that close :8081 to everything but 10.10.0.0/24 and 10.244.0.0/16.
2026-10-27 00:12:38 -04:00
Sirius DevOps
f9189482e7
Initial HomeK8s tree matching lab GitOps layout.
Storage and Gateway apply with kubectl -k until Forgejo+Flux.
2026-09-10 23:38:04 -04:00