06 — Monitoring (Prometheus + VictoriaMetrics, Service + Pod targets)
Three workloads exercising the monitoring matrix:
api— PrometheusServiceMonitor(CRD discovery + service target).worker— PrometheusPodMonitor(CRD discovery + pod target). No Service.legacy— annotations-mode (prometheus.io/scrapeetc.) for clusters that haven’t installed Prometheus Operator CRDs.
Plus chart-level exposeService.enabled: true so metrics ports are auto-emitted on Services that don’t declare one.
What this shows
integrations.monitoring.defaultssets Prometheus + CRD + service as the cluster default.- Per-workload
metrics.*overrides every axis individually:apiaccepts the defaults (single value:metrics.enabled: true).workerswitchestype: podto emit aPodMonitorinstead.legacyswitchesdiscovery: annotationsto skip the CRD entirely.
- Auto-exposed metrics port on
api(exposeService.enabled: truewith no explicitservice.ports.metrics). - Metrics-only Service for
workerbecause itsservice.enabled: false— the chart still emits a<release>-worker-metricsService so the PodMonitor’s port name resolves cleanly. - A
victoriametrics-flavouredworkload showing the per-workload provider override.
Delta from 02-web-app-ingress
| Changed | What |
|---|---|
integrations.monitoring.defaults | Set chart-level monitoring defaults explicitly. |
| Three workloads | One per discovery/target combination. |
metrics.exposeService.enabled | Enabled chart-wide so the metrics port lands automatically where applicable. |
metrics.type: pod on worker | PodMonitor instead of ServiceMonitor. |
metrics.discovery: annotations on legacy | Bare Prometheus annotations on the Service. |
metrics.provider: victoriametrics on vm-flavoured | Per-workload provider override (emits VMServiceScrape instead of ServiceMonitor). |
Files
| File | Purpose |
|---|---|
values.yaml | Chart values. |
argocd/application.yaml | Argo CD Application, single source. |
argocd/application-multisource.yaml | Argo CD Application with spec.sources[]. |
flux/ocirepository.yaml | Flux OCIRepository. |
flux/helmrelease.yaml | Flux HelmRelease. |
helm/install.sh | Plain helm upgrade --install. |
Try it
bash helm/install.sh
kubectl apply -f argocd/application.yaml -n argocd
kubectl apply -f flux/
Prerequisites
- Prometheus Operator CRDs (
monitoring.coreos.com) installed forServiceMonitor/PodMonitorto materialise. - VictoriaMetrics Operator CRDs (
operator.victoriametrics.com) installed for thevm-flavouredworkload’sVMServiceScrape. Remove thevm-flavouredworkload if VM Operator isn’t present. - Prometheus / vmagent configured to discover the right CRDs / pick up annotations.