fix(grafana): disable init-chown-data for Pod Security / k3s

Made-with: Cursor
This commit is contained in:
timotheereausanofi
2026-03-20 11:34:52 +01:00
parent 4f66f7f7ed
commit 1dc04c9fc5
2 changed files with 7 additions and 0 deletions

View File

@@ -28,6 +28,10 @@ Grafanas **dashboard sidecar** loads ConfigMap **`…-dashboard-onelab-logs`*
- **Line filter** — regex applied to log line content (`.*` = all). - **Line filter** — regex applied to log line content (`.*` = all).
- Stat panels: total lines, heuristic **error** / **warning** counts (tuned for typical text logs, not strict JSON parsing). - Stat panels: total lines, heuristic **error** / **warning** counts (tuned for typical text logs, not strict JSON parsing).
### Grafana pod: `init-chown-data` CrashLoopBackOff
The upstream chart runs an init container as **root** to `chown` `/var/lib/grafana`. Clusters with **Pod Security Admission** (often on k3s) commonly block that. This repo sets **`grafana.initChownData.enabled: false`**; the Grafana pod keeps **`fsGroup: 472`** so the PVC is usually group-writable. If Grafana still cannot write to disk, delete the Grafana PVC once after the change or relax PSA for namespace `onelab`.
## Access Grafana ## Access Grafana
An **Ingress** named **`grafana-onelab`** is created by the umbrella chart (`templates/ingress-grafana-onelab.yaml`), Traefik + cert-manager, matching the OneLab web UI pattern in `gitops/values/k3s-example.yaml`: An **Ingress** named **`grafana-onelab`** is created by the umbrella chart (`templates/ingress-grafana-onelab.yaml`), Traefik + cert-manager, matching the OneLab web UI pattern in `gitops/values/k3s-example.yaml`:

View File

@@ -109,6 +109,9 @@ grafanaOnelabIngress:
grafana: grafana:
adminUser: admin adminUser: admin
adminPassword: changeme adminPassword: changeme
# Root+CHOWN init breaks under Pod Security / restricted policies (k3s). fsGroup:472 on the pod is enough for most PVCs.
initChownData:
enabled: false
# Load dashboards from ConfigMaps labeled grafana_dashboard (see templates/configmap-dashboard-onelab-logs.yaml). # Load dashboards from ConfigMaps labeled grafana_dashboard (see templates/configmap-dashboard-onelab-logs.yaml).
sidecar: sidecar:
dashboards: dashboards: