Skip to content

[grafana] Document that the admin password is only applied on first start - #896

Merged
jkroepke merged 1 commit into
grafana-community:mainfrom
fjvbn2003:grafana-admin-password-first-start
Oct 16, 2026
Merged

jkroepke merged 1 commit into
grafana-community:mainfrom
fjvbn2003:grafana-admin-password-first-start

Conversation

@fjvbn2003

Copy link
Copy Markdown

What this PR does / why we need it

The README does not say what happens when adminPassword or the password in admin.existingSecret is changed after the first install. Grafana reads GF_SECURITY_ADMIN_PASSWORD only when it creates the admin user ("Set once on first-run", configuration reference). With a persistent database, a helm upgrade restarts the pod with the new value and Grafana keeps the old password. This has been reported many times in the old repository (grafana#152, grafana#3568, grafana#3790), and the README in this repository still does not mention it.

This PR adds an "Admin user and password" section that covers:

  • changing the value after the first start does not change the stored password;
  • the sidecars authenticate their reload calls with the same Secret (REQ_USERNAME / REQ_PASSWORD in templates/_pod.tpl), so they get 401 once the Secret and the database disagree;
  • the generated password (grafana.password in templates/_helpers.tpl) relies on lookup. Renderers that use helm template, such as Argo CD, get a new random value on every render;
  • how to rotate the password: reset it in Grafana first, then update the Secret.

Chart version bumped to 14.0.1 (docs only).

How I verified it

  • Grafana 13.2.0, one pod with a sqlite data directory that survives a restart:
    • first start with GF_SECURITY_ADMIN_PASSWORD=pw-one: GET /api/user with pw-one returns 200, pw-two returns 401;
    • restart on the same data directory with GF_SECURITY_ADMIN_PASSWORD=pw-two: pw-one still returns 200 and pw-two returns 401;
    • printf 'pw-two\n' | grafana cli --config <ini> admin reset-admin-password --password-from-stdin (the command shown in the README): pw-one returns 401 and pw-two returns 200.
  • helm template (Helm v3.18.2) of this chart run twice without adminPassword renders two different admin-password values in templates/secret.yaml. With --set adminPassword=x the value stays the same.
  • The 13.2.4-distroless image (the chart's default) has /usr/share/grafana/bin on PATH, so grafana cli works through kubectl exec without a shell. The chart also sets GF_PATHS_DATA, so the CLI opens the same database as the server.
  • helm lint charts/grafana passes.

Which issue this PR fixes

Special notes for your reviewer

This changes documentation only, so I did not add a helm-unittest case.

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [grafana])

This change was drafted with AI assistance and reviewed by me.

🤖 Generated with Claude Code

…tart

Grafana reads GF_SECURITY_ADMIN_PASSWORD only when it creates the admin
user. With a persistent database, changing adminPassword or the existing
Secret leaves the stored password unchanged, and the sidecars, which
authenticate with the Secret, start getting 401 on reload calls. With
renderers that cannot use lookup (Argo CD), the generated password also
changes on every render.

Describe this in the README and show how to rotate the password.

Signed-off-by: YoungjuKim <[email protected]>
@jkroepke

jkroepke commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Thanks!

@jkroepke
jkroepke merged commit e45de0a into grafana-community:main Oct 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants