From cc8ce7474610b6251875a3002ed86910cc0d8cd9 Mon Sep 17 00:00:00 2001 From: Lance Walters Date: Tue, 27 Oct 2026 00:53:29 -0400 Subject: [PATCH] grafana: persist /var/lib/grafana on a 5Gi local-path PVC + pin GF_SECURITY_SECRET_KEY In-app admin password changes and session state died with every pod because the sqlite DB was container-local and secret_key regenerated on each boot (clients bounced on / with 'user token not found'). Recreate strategy is required: a RWO local-path PVC cannot be mounted by old+new pod during a rolling update. Secret monitoring/grafana-secret-key is out of band, key secret_key. --- monitoring/controllers/home/values.yaml | 30 ++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/monitoring/controllers/home/values.yaml b/monitoring/controllers/home/values.yaml index 51be14a..79eb43b 100644 --- a/monitoring/controllers/home/values.yaml +++ b/monitoring/controllers/home/values.yaml @@ -102,10 +102,34 @@ grafana: datasources: enabled: true label: grafana_datasource - # No persistence: Grafana state is provisioned from git, and a PVC here would - # only compete for the same disk that Prometheus needs. + # Persistence: Grafana's own sqlite DB (/var/lib/grafana/grafana.db) now lives + # on a local-path PVC on siriussec, so an in-app admin-password change and any + # session/API-key state survive a pod restart. Dashboards + datasources are + # STILL provisioned from ConfigMaps below and win over UI edits — that is the + # source of truth, and the reason only credentials/session state needed a PVC. + # 5Gi is generous for a sqlite DB that is measured in MB; the PV sits next to + # Prometheus's 10Gi on the same disk. persistence: - enabled: false + enabled: true + type: pvc + storageClassName: local-path + accessModes: + - ReadWriteOnce + size: 5Gi + # A single local-path RWO PVC cannot be mounted by old + new pod at once, so a + # rolling update deadlocks (new pod Pending on the volume). Recreate is + # required with persistence enabled. + deploymentStrategy: + type: Recreate + # Stable session-signing key. Without this Grafana generates a fresh + # secret_key on every boot, so every existing browser cookie becomes + # "user token not found" and the client bounces on /. The Secret + # monitoring/grafana-secret-key is created out of band (never in git). + envValueFrom: + GF_SECURITY_SECRET_KEY: + secretKeyRef: + name: grafana-secret-key + key: secret_key grafana.ini: auth.anonymous: enabled: false