charts icon indicating copy to clipboard operation
charts copied to clipboard

[stable/grafana] Login defined in .values.admin.existingSecret is invalid

Open Kajitsuken opened this issue 6 years ago • 7 comments

Describe the bug

When setting admin username and password via .admin.existingSecret in values.yaml, the defined login is not working when trying to log into the Grafana web UI with the defined credentials.

Version of Helm and Kubernetes Helm: 3.1.0 Kubernetes: 1.17.3

Which chart stable/grafana Chart version: 5.0.3

What happened After configuring the following secret

apiVersion: v1
kind: Secret
metadata:
  name: grafana
  namespace: grafana
type: Opaque
data:
  adminUser: YWRtaW4K #admin
  adminPassword: <REDACTED>

and applying it to the cluster and then configuring the following section in the charts values.yaml

    # Administrator credentials when not using an existing secret (see below)
    adminUser: admin
    # adminPassword: password

    # Use an existing secret for the admin user.
    admin:
      existingSecret: grafana
      userKey: adminUser
      passwordKey: adminPassword

and deploying the chart, login with the credentials defined in the secret fails with an Invalid username or password exception.

What you expected to happen Login with the credentials defined in the secrets succeeds.

Anything else we need to know? Both values for userKey and passwordKey have been base64 encoded via echo 'admin' | base64 -w 0 and have then been included in the secret.

Multiple passwords with and without special characters have been tried without a change in behavior, same for the username.

Name of the secret has been changed without change in behavior.

When kubectl exec -ti <pod-name> -c grafana sh followed by running env, both GF_SECURITY_ADMIN_USER and GF_SECURITY_ADMIN_PASSWORD are set to the correct values defined in the secret, yet login doesn't work.

When not using a secret to configure the admin login, but configuring

    # Administrator credentials when not using an existing secret (see below)
    adminUser: admin
    adminPassword: password

in values.yaml, login to Grafana succeeds with the defined login.

Kajitsuken avatar Feb 27 '20 20:02 Kajitsuken

Bumping this, I tried overriding the admin password with the default grafana chart values for using a secret and get "Pod errors: CreateContainerConfigError"

grafana:
  adminPassword: null
  admin:
    existingSecret: grafana-admin-secret
    passwordKey: admin-secret

smark88 avatar Mar 05 '20 20:03 smark88

Yeah, also just run into this - defined a secret, set the values, reinstalled Grafana after a helm delete --purge grafana and can't log in.

seeruk avatar Apr 01 '20 15:04 seeruk

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

stale[bot] avatar May 01 '20 21:05 stale[bot]

This issue is being automatically closed due to inactivity.

stale[bot] avatar May 15 '20 22:05 stale[bot]

I just run into this issue as well does someone has a solution?

DMSwimTech avatar Jul 16 '20 15:07 DMSwimTech

I figure out what I have been doing wrong. Instead off using data I used stringData: apiVersion: v1 kind: Secret metadata: name: grafana-secret type: Opaque stringData: admin-user: admin admin-password: admin

so if someone encounters it I hope this post will help you

DMSwimTech avatar Jul 19 '20 13:07 DMSwimTech

I figure out what I have been doing wrong. Instead off using data I used stringData: apiVersion: v1 kind: Secret metadata: name: grafana-secret type: Opaque stringData: admin-user: admin admin-password: admin

so if someone encounters it I hope this post will help you

These recently resolve the issue for me as well. I validated the environment variable in the running pod was correct, so not sure why the change from data -> stringData changes behavior

mnoseworthy avatar May 02 '21 14:05 mnoseworthy