Commit graph homek8s/monitoring
Author SHA1 Message Date
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