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.
This commit is contained in:
parent
39d707236c
commit
cc8ce74746
1 changed files with 27 additions and 3 deletions
|
|
@ -102,10 +102,34 @@ grafana:
|
||||||
datasources:
|
datasources:
|
||||||
enabled: true
|
enabled: true
|
||||||
label: grafana_datasource
|
label: grafana_datasource
|
||||||
# No persistence: Grafana state is provisioned from git, and a PVC here would
|
# Persistence: Grafana's own sqlite DB (/var/lib/grafana/grafana.db) now lives
|
||||||
# only compete for the same disk that Prometheus needs.
|
# 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:
|
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:
|
grafana.ini:
|
||||||
auth.anonymous:
|
auth.anonymous:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue