Skip to content

Add monitoring: VictoriaMetrics stack and Grafana on grafana.int - #106

Merged
bulbashenko merged 1 commit into
mainfrom
monitoring
Oct 12, 2026
Merged

bulbashenko merged 1 commit into
mainfrom
monitoring

Conversation

@bulbashenko

Copy link
Copy Markdown
Contributor

Closes #74.

What

  • infrastructure/controllers/victoria-metrics-operator.yaml: namespace monitoring and VM operator 0.68.1 (v0.75.0). CRDs come from the plain crds/ dir, with CreateReplace. The webhook cert comes from cert-manager.
  • infrastructure/configs/monitoring/: victoria-metrics-k8s-stack 0.96.0 (VM v1.154.0), release vm:
    • VMSingle: 30d retention, 10Gi local-path PVC. vmagent scrapes every 30s, with cluster=hel1.
    • vmalert + Alertmanager. Alertmanager has no receiver yet; Telegram is Алерты в Telegram #75.
    • node-exporter and kube-state-metrics. KSM exports the bulbashenko.com/layer and bulbashenko.com/app labels.
    • Grafana with no PVC, mesh-only IngressRoute grafana.int, and OIDC via Hydra client grafana (auth#18). Only infra-admins get in, and they get GrafanaAdmin.
    • Off for k3s: controller-manager, scheduler, kube-proxy and etcd scrapes, plus their rules and dashboards. They run inside the k3s process on localhost; the datastore is sqlite.
    • Scrapes: Traefik, cloudflared, cert-manager, CNPG operator, Flux, VM operator.
    • Dashboard "Cluster by layer" (dashboards/cluster-by-layer.json): CPU, memory, restarts and readiness by layer and by app, plus a table of scrape targets.
  • apps/production/data/scrapes.yaml: CNPG pg (9187) and Garage (/metrics on the admin port, with the existing metrics token).
  • apps/mail/scrape.yaml plus STALWART_METRICS_USERNAME/STALWART_METRICS_PASSWORD in Secret stalwart.
  • apps/production/auth/secret.sops.yaml: OIDC_GRAFANA_CLIENT_SECRET, the same value as in monitoring/grafana.
  • Headscale extra_record grafana.int → 100.64.0.5. Headscale restarts because the ConfigMap hash changes.
  • README: a Monitoring section and a note in Labels.

Order and owner steps

  1. Merge this PR. Flux installs the operator, then the stack. The first install may take longer than the 5m timeout of infrastructure; it retries.
  2. Merge auth#18, then the deploy/auth PR it opens. The hydra-clients Job then creates the grafana client.
  3. Stalwart:
    • kubectl -n mail rollout restart deploy/stalwart, so the pod gets the new env vars. Mail is down for a few seconds; senders retry.
    • In https://mail.int.bulbashenko.com go to Settings › Telemetry › Metrics › Prometheus and set: Enabled, authUsername vmagent, authSecret = Environment variable STALWART_METRICS_PASSWORD.
  4. Open https://grafana.int.bulbashenko.com from the mesh.

Checked locally

  • kubectl kustomize passes for every overlay CI builds.
  • helm template of both charts with these values renders; VMPodScrape fields were checked against the CRD schema.
  • No duplicate YAML keys; scripts/check-sops.sh passes; the client secret is identical in both Secrets (compared by hash).

🤖 Generated with Claude Code

The plan replaces Uptime Kuma with victoria-metrics-k8s-stack. The operator
is its own release in infrastructure/controllers so the VM CRDs exist
before the stack and the scrape objects in infrastructure/configs are
applied.

- VMSingle keeps 30 days (40 GB disks, 30 s scrape interval).
- k3s runs the controller manager, scheduler and kube-proxy inside the
  k3s process and has no etcd, so those scrapes, rules and dashboards
  are off.
- Grafana signs in through Ory (client grafana, infra-admins only, as
  server admin), is reachable from the mesh only and has no PVC.
- Extra scrapes: Traefik, cloudflared, cert-manager, CNPG operator, Flux,
  the VM operator; CNPG and Garage next to the data app, Stalwart next
  to mail (the Prometheus endpoint is switched on in Stalwart's settings).
- kube-state-metrics exports the bulbashenko.com/* labels; the dashboard
  "Cluster by layer" groups resources and health by them.
- Alertmanager has no receiver yet (Telegram is #75).

Refs #74

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bulbashenko
bulbashenko merged commit acc46fe into main Oct 12, 2026
4 checks passed
@bulbashenko
bulbashenko deleted the monitoring branch October 12, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Мониторинг: victoria-metrics-k8s-stack + Grafana

1 participant