5.0 KiB
Probes on an internal port, authenticated three-state health, self-hosted Victoria stack
ADR-0002 allows no anonymous public endpoints, but kubelet probes can't carry a Token. So hAPI listens on two ports. :8000 serves the API and is the only port the Gateway routes. :8081 is internal: it is never routed, and a NetworkPolicy limits it to kubelet and the metrics scraper. It serves /livez, /readyz and /metrics without auth, from the same process and event loop as the API, so a wedged loop fails liveness. External health is GET /v1/health on the public API. It needs the health Scope, and it reports ok, degraded or down using only check names and ok/fail. Uptime Kuma, a Bot on its own public VM, polls it. Logs and metrics go to VictoriaLogs and VictoriaMetrics, self-hosted in the cluster. The Owner reads them through Grafana over a port-forward on the management tailnet. We chose this stack over Prometheus + Loki because it fits beside hAPI on two 4 GB workers, and over a SaaS because logs carry Principal ids and the breakglass audit trail (ADR-0004), which shouldn't leave the cluster.
Considered Options
- Probes on the public port, unauthenticated. Rejected: it breaks ADR-0002's "no anonymous endpoints" rule. A probe path the Gateway happens not to route is also easier to expose by mistake than a port it never routes.
- Readiness that checks the database. Rejected: one blip of the managed database would mark every pod unready at once, and the NodeBalancer would serve nothing. A 503 with an RFC 9457 body is more honest. Database health goes into
/v1/healthand metrics instead. - Separate health endpoints per concern (e.g. one for the HA bridge). Rejected in favour of one endpoint with critical and non-critical checks, which gives Kuma a "degraded" signal without a second route.
- Prometheus + Loki (+ Alloy). The industry standard. Rejected for v1 on footprint: it needs about 1.5–2 GB before tuning, on workers that also run hAPI, Flux and Cilium.
- Grafana Cloud or another SaaS. Rejected: it would put a vendor in the data path for Principal ids and audit events.
- Built-in vmui / VictoriaLogs UI only. Workable, but provisioned dashboards earn Grafana its place.
- Write-once off-cluster storage for breakglass audit events. Deferred: the Owner controls the cluster and is the one who runs breakglass. In v1, tamper-evidence comes from a Household ntfy alert on every breakglass start.
Consequences
/livezreturns a constant./readyzpasses once startup is done (config loaded, pools created). On SIGTERM,/readyzfails first and the pod drains for about 5 s before it shuts down. Readiness also gates rollouts (ADR-0007): an image that never becomes Ready stalls the rollout./v1/healthchecksdb(aSELECT 1through the app pool) andschema(at the expected Alembic head). These are critical: if either fails, the status isdownwith HTTP 503. It also checksha_bridge(no poll for 5 min, see ADR-0006) andjob_backlog(oldest pending Job too old). These are non-critical: if one fails, the status isdegradedwith HTTP 200. Bodies carry no error text, hostnames, versions or latencies. Kuma points two monitors at it: up (HTTP status) and healthy (a JSON query assertingstatus == "ok").- Collection: vmagent scrapes the app, kubelet/cAdvisor, kube-state-metrics, node-exporter, Flux and Cilium. A Vector DaemonSet takes pod stdout and Talos service logs (
machine.logging, JSON over TCP). An event exporter ships Kubernetes Events as logs. Everything lives in amonitoringnamespace on Block Storage PVs and arrives as FluxHelmReleases. - App metrics come from
prometheus-client: requests by route template, method and status; latency; DB pool usage; Job depth, age and failures; seconds since HA's last poll; auth failures by reason. Labels never carryprincipal_idor Personal data. Per-Principal detail stays in logs. - Retention: logs and metrics are kept for 30 days, breakglass audit events for 1 year. Amended by ADR-0014: the daily backup job also exports breakglass audit events to the backup bucket, and the off-account copy keeps them for 1 year, so they survive a cluster rebuild.
- Locked down: Grafana requires login, with analytics, update checks and Gravatar off. Datasource plugins are pinned in the image. Outbound traffic from
monitoringis denied by default, except vmalert → ntfy and the Watchdog → Kuma push. - Every failure has one alerting owner.
- Kuma: reachability and degraded status.
- Flux notification-controller: failed reconciles, migrate Jobs and rollouts.
- vmalert: PVs filling, crash loops, the DB pool near ADR-0004's budget, Jobs piling up or failing, a node NotReady.
- Watchdog: an always-firing alert pushes to a Kuma push monitor, so the monitoring stack dying is caught from outside. The push URL is a SOPS secret (ADR-0008).
- Never public:
:8081, Grafana, VictoriaMetrics and VictoriaLogs. They're reachable only bykubectl port-forwardover the management tailnet.