bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
9.06k stars 9.23k forks source link

Cannot authenticate database with provided postgresqlPassword #3552

Closed manhhailua closed 4 years ago

manhhailua commented 4 years ago

Which chart: bitnami/postgresql (9.3.3)

Describe the bug After a very normal installation of postgresql chart, I could not access the database with provided postgresqlPassword even if the provided postgresqlPassword value was correctly set to secret. The database can be authenticated if no postgresqlPassword is set (use auto generated password - sudo helm install postgresql-01 bitnami/postgresql).

To Reproduce Steps to reproduce the behavior:

  1. Run sudo helm install postgresql-01 bitnami/postgresql --set postgresqlPassword=1qaz2wsx
  2. Run export POSTGRES_PASSWORD=$(sudo kubectl get secret --namespace vindr-dev postgresql-01 -o jsonpath="{.data.postgresql-password}" | base64 --decode)
  3. Run sudo kubectl run postgresql-01-client --rm --tty -i --restart='Never' --namespace vindr-dev --image docker.io/bitnami/postgresql:11.9.0-debian-10-r1 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host postgresql-01 -U postgres -d postgres -p 5432
  4. See error:
    psql: FATAL:  password authentication failed for user "postgres"
    pod "postgresql-01-client" deleted
    pod vindr-dev/postgresql-01-client terminated (Error)

Expected behavior The databased should be authenticated.

Version of Helm and Kubernetes:

version.BuildInfo{Version:"v3.3.0", GitCommit:"8a4aeec08d67a7b84472007529e8097ec3742105", GitTreeState:"dirty", GoVersion:"go1.14.7"}
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8+k3s1", GitCommit:"6b595318666804506c19cfc3d3d228423d38fab1", GitTreeState:"clean", BuildDate:"2020-08-14T20:42:29Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8+k3s1", GitCommit:"6b595318666804506c19cfc3d3d228423d38fab1", GitTreeState:"clean", BuildDate:"2020-08-14T20:42:29Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

Additional context My kubernetes cluster is a K3S cluster with 1 master and 3 nodes, traefik disabled and using longhorn storageclass.

dani8art commented 4 years ago

Hi @manhhailua thanks for opening the issue,

We've checked the steps you have mentioned above but we weren't able to reproduce the issue. Could you check if you have already a PVC from a previous deployment and it is conflicting with the new password? Please, could you try to install it again from scratch?

$ kubectl delete pvc data-postgresql-01-postgresql-0
$ helm install postgresql-01 bitnami/postgresql --set postgresqlPassword=1qaz2wsx

These steps worked for me.

manhhailua commented 4 years ago

@dani8art Oops, my bad! Thank you! I deleted all the pvc using the Longhorn UI, It's worked now. As you said, the passwords conflicted somehow.