Charts: psql: FATAL: password authentication failed for user "postgres"

Created on 14 Feb 2019  路  6Comments  路  Source: helm/charts

Is this a request for help?:


Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT

Version of Helm and Kubernetes:

Which chart:
stable/postgres

What happened:
helm install --name bitnami-sucks stable/postgresql --set "persistence.storageClass=postgres-plain,persistence.size=100Gi"

export POSTGRES_PASSWORD=$(kubectl get secret --namespace default bitnami-sucks-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
kubectl port-forward --namespace default svc/bitnami-sucks-postgresql 5432:5432
psql --host 127.0.0.1 -U myuser
psql: FATAL: password authentication failed for user "myuser"

What you expected to happen:
Not to waste my whole damn day with this BS chart

How to reproduce it (as minimally and precisely as possible):
Follow the steps above

Anything else we need to know:

lifecyclstale

Most helpful comment

I am facing similar issue and below is the command i used to deploy the helm chart :
helm install azure-marketplace/postgresql --version=4.2.1 --name in1-psql-release --set global.imagePullSecrets={empotysecret} --set networkPolicy.enabled=true --set postgresqlPassword=** . My Postgres is deployed in azure k8s service

All 6 comments

When I look on the container I see:
POSTGRESQL_PASSWORD=
POSTGRESQL_USERNAME=postgres

POSTGRES_PASSWORD=mypass
POSTGRES_USER=myuser

When the chart is run with:
helm install --name bitnami-sucks stable/postgresql --set "postgresqlUsername=myuser,postgresqlPassword=mypass,persistence.storageClass=postgres-plain,persistence.size=100Gi"

It seems to me that POSTGRESQL_USER and POSTGRESQL_PASS should be set to the values I'm setting them to but you're setting POSTGRES_USER and POSTGRES_PASS instead.

In fact I can login to the database with -U postgres and no pass, where as my user and pass don't work at all. It sure looks like the container is preferring the POSGRESQL_* vars and ignoring the POSTGRES_* ones.

First issue:

helm install --name bitnami-sucks stable/postgresql --set "persistence.storageClass=postgres-plain,persistence.size=100Gi"

export POSTGRES_PASSWORD=$(kubectl get secret --namespace default bitnami-sucks-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
kubectl port-forward --namespace default svc/bitnami-sucks-postgresql 5432:5432
psql --host 127.0.0.1 -U myuser
psql: FATAL: password authentication failed for user "myuser"

You can't login with the user myuser because you did not specify it when deploying the chart. In that case, the default value is postgres as it can be seen in the values.yaml.

Second issue:

When the chart is run with:
helm install --name bitnami-sucks stable/postgresql --set "postgresqlUsername=myuser,postgresqlPassword=mypass,persistence.storageClass=postgres-plain,persistence.size=100Gi"

If you specify a custom user other than postgres, you should also specify a database name. This is clearer when launching the container directly as an error message pops up but kubernetes hide this error with a retry. We should improve this use case so it is clear.

If you run the following command it should work:

helm install --name postgresql stable/postgresql --set "postgresqlUsername=myuser,postgresqlPassword=mypass,postgresqlDatabase=myuserdb,persistence.storageClass=postgres-plain,persistence.size=100Gi"

Regarding the different sets of env vars, the bitnami/postgresql container supports both but POSTGRES_ env vars have preference over POSTGRESQL_ ones. We did this so the chart can also be used with the Docker postgres image.

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.

This issue is being automatically closed due to inactivity.

I am facing similar issue and below is the command i used to deploy the helm chart :
helm install azure-marketplace/postgresql --version=4.2.1 --name in1-psql-release --set global.imagePullSecrets={empotysecret} --set networkPolicy.enabled=true --set postgresqlPassword=** . My Postgres is deployed in azure k8s service

We can reset the password for PostgreSQL, documentation of how to do this is already provided by bitnami.
I have applied this & it's working perfectly fine.

https://docs.bitnami.com/aws/infrastructure/postgresql/administration/change-reset-password/

Was this page helpful?
0 / 5 - 0 ratings