Files
DongHyeonka 012452cf78 feat(observability): alert on host backups, drift and k3s serving certs
Backups, the daily drift check and the k3s serving certificates have no
alert. k3s renews certificates only when it starts within 120 days of
expiry, and the two kube-prometheus-stack kubelet certificate alerts
can never fire because the k3s kubelet exports no
kubelet_certificate_manager_* metric.

Add a PrometheusRule (platform-host-checks) for backup age, failed
runs, missing metrics, drift left for 6h, a stale drift check, and
serving certificate expiry (warning under 100 days, critical under 14).
Add the two remaining host timers (certificate expiry via openssl on
6443 and 10250; the drift check against origin/main) and an installer
that copies the scripts to a root-owned path, creates the textfile and
work directories and enables all four timers. Disable the two dead
kubelet certificate rules in kube-prometheus-stack.

Risk: the metrics need the node-exporter textfile collector, a one-line
change in W1's node-exporter values that was asked of W1. Until then
PlatformHostBackupMetricsAbsent fires after a day, which is the point.

Verification (desktop):
- test-platform-host-checks-alerts.sh: promtool check and unit tests
  pass; with the k3s threshold changed from 2 to 5 days they fail.
- render-observability-core.sh passes; the render has no Kubelet*
  certificate alerts and still has both KubeClientCertificateExpiration.
- k3s-cert-expiry.sh as the desktop user reads both certificates.
- install-host-checks.sh --check: systemd-analyze verify is clean.
2026-11-12 01:13:02 +09:00
..

kube-prometheus-stack

고정 chart 88.0.1을 observability namespace에 렌더한다. Grafana와 node-exporter, control-plane에 존재하지 않는 scheduler/controller-manager/etcd/ kube-proxy monitor는 끈다. Prometheus와 Alertmanager 데이터는 각각의 Retain Local PV에 보존하며 CRD는 별도 root에서 먼저 적용한다.

Prometheus discovery는 namespace label observability.hyeonworks.com/enabled=true와 resource label observability.hyeonworks.com/instance=home의 교집합만 선택한다.

Alertmanager source는 selector discovery 대신 global alertmanagerConfiguration.name=platform-alertmanager를 참조한다. 참조 대상의 Slack Secret이 준비되기 전에는 이 변경을 live에 적용하지 않고 기존 null 구성을 유지한다.

Prometheus TSDB는 outOfOrderTimeWindow: 10h로 늦게 도착한 샘플을 받는다. 시계가 앞으로 튀었다가 되돌아오면 TSDB 머리에 미래 시각 샘플이 남고, 창이 0이면 그 시각이 지날 때까지 모든 수집이 out of bounds로 버려진다. 메트릭과 경보가 함께 멈추고, absent() 경보(KubeAPIDown 등)는 거짓으로 울린다. 10시간은 재부팅 때 RTC의 KST를 UTC로 읽는 +9시간 오차를 덮는 값이다(2026-11-11 사고). 늦은 샘플이 없으면 추가 메모리는 거의 들지 않는다. 시계 자체를 막는 설정은 infrastructure/host가 맡는다.