chore: Add monitoring to grafana for flux.

This commit is contained in:
2026-02-27 07:31:27 +01:00
parent 091e7b78df
commit 0526b819a0
4 changed files with 135 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
---
# yaml-language-server: $schema=https://schemas.tholinka.dev/grafana.integreatly.org/grafanadashboard_v1beta1.json
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: flux-k8s-api-performance
spec:
allowCrossNamespaceImport: true
instanceSelector:
matchLabels:
grafana.internal/instance: grafana
datasources:
- datasourceName: prometheus
inputName: DS_PROMETHEUS
url: https://raw.githubusercontent.com/controlplaneio-fluxcd/flux-operator/refs/heads/main/config/monitoring/dashboards/flux-k8s-api-performance.json
---
# yaml-language-server: $schema=https://schemas.tholinka.dev/grafana.integreatly.org/grafanadashboard_v1beta1.json
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: flux-performance
spec:
allowCrossNamespaceImport: true
instanceSelector:
matchLabels:
grafana.internal/instance: grafana
datasources:
- datasourceName: prometheus
inputName: DS_PROMETHEUS
url: https://raw.githubusercontent.com/controlplaneio-fluxcd/flux-operator/refs/heads/main/config/monitoring/dashboards/flux-performance.json
---
# yaml-language-server: $schema=https://schemas.tholinka.dev/grafana.integreatly.org/grafanadashboard_v1beta1.json
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: flux-cluster
spec:
allowCrossNamespaceImport: true
instanceSelector:
matchLabels:
grafana.internal/instance: grafana
datasources:
- datasourceName: prometheus
inputName: DS_PROMETHEUS
url: https://raw.githubusercontent.com/fluxcd/flux2-monitoring-example/refs/heads/main/monitoring/configs/dashboards/cluster.json
---
# yaml-language-server: $schema=https://schemas.tholinka.dev/grafana.integreatly.org/grafanadashboard_v1beta1.json
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
name: flux-control-plane
spec:
allowCrossNamespaceImport: true
instanceSelector:
matchLabels:
grafana.internal/instance: grafana
datasources:
- datasourceName: prometheus
inputName: DS_PROMETHEUS
url: https://raw.githubusercontent.com/fluxcd/flux2-monitoring-example/refs/heads/main/monitoring/configs/dashboards/control-plane.json

View File

@@ -7,3 +7,6 @@ resources:
- ./secret.sops.yaml
- ./httproute.yaml
- ./receiver.yaml
- ./grafanadashboard.yaml
- ./podmonitor.yaml
- ./prometheusrule.yaml

View File

@@ -0,0 +1,22 @@
---
# yaml-language-server: $schema=https://schemas.tholinka.dev/monitoring.coreos.com/podmonitor_v1.json
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: flux-components
spec:
namespaceSelector:
matchNames:
- flux-system
podMetricsEndpoints:
- honorLabels: true
port: http-prom
selector:
matchExpressions:
- key: app.kubernetes.io/component
operator: In
values:
- helm-controller
- source-controller
- kustomize-controller
- notification-controller

View File

@@ -0,0 +1,50 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/monitoring.coreos.com/prometheusrule_v1.json
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: flux-instance-rules
namespace: flux-system
spec:
groups:
- name: flux-instance.rules
rules:
- alert: FluxInstanceAbsent
expr: |-
absent(flux_instance_info{exported_namespace="flux-system", name="flux"})
for: 5m
annotations:
summary: >-
Flux instance metric is missing
labels:
severity: critical
- alert: FluxInstanceNotReady
expr: |-
flux_instance_info{exported_namespace="flux-system", name="flux", ready!="True"}
for: 5m
annotations:
summary: >-
Flux instance {{ $labels.name }} is not ready
labels:
severity: critical
- alert: HelmReleaseReconciliationFailure
expr: |-
gotk_resource_info{customresource_kind="HelmRelease", ready!="True"} == 1
for: 5m
annotations:
summary: >-
HelmRelease {{ $labels.name }} in {{ $labels.exported_namespace }} is not ready
labels:
severity: critical
- alert: KustomizationReconciliationFailure
expr: |-
gotk_resource_info{customresource_kind="Kustomization", ready!="True"} == 1
for: 5m
annotations:
summary: >-
Kustomization {{ $labels.name }} in {{ $labels.exported_namespace }} is not ready
labels:
severity: critical