Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/postgresql] password authentication failed for a user/pwd specified using values: "auth.username" and "auth.password" #15975

Closed
cmoulliard opened this issue Apr 6, 2023 · 9 comments
Assignees
Labels
postgresql stale 15 days without activity tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@cmoulliard
Copy link

Name and Version

bitnami/postgresql 11.9.13

What architecture are you using?

amd64

What steps will reproduce the bug?

  1. Create a kind cluster
  2. Deploy the helm chart as such
DB_USERNAME=healthy
DB_PASSWORD=healthy

VERSION=11.9.13
helm install postgresql bitnami/postgresql \
  --version $VERSION \
  --set auth.username=$DB_USERNAME \
  --set auth.password=$DB_PASSWORD \
  --set auth.database=fruits_database \
  --create-namespace \
  -n db
  1. Check if the pod has been well created
kubectl get po -n db
NAME           READY   STATUS    RESTARTS   AGE
postgresql-0   1/1     Running   0          18s
  1. Access the DB using the psql client
export POSTGRES_PASSWORD=$(kubectl get secret --namespace db postgresql -o jsonpath="{.data.password}" | base64 -d)
kubectl run postgresql-client --rm --tty -i --restart='Never' --namespace db --image docker.io/bitnami/postgresql:14.5.0-debian-11-r35 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
      --command -- psql --host postgresql -U healthy -d fruits_database -p 5432
psql: error: connection to server at "postgresql" (10.96.93.222), port 5432 failed: FATAL:  password authentication failed for user "healthy"
pod "postgresql-client" deleted
pod db/postgresql-client terminated (Error)
  1. Verify the password matches what it has ben passed as helm value
echo $POSTGRES_PASSWORD
healthy

As the password encoded corresponds to what it has been passed as value to the helm chart using auth.password, there is certainly an issue with the init step as we cannot access the db fruits_database using the user healthy and password healthy

Are you using any custom parameters or values?

--set auth.username=$DB_USERNAME \
--set auth.password=$DB_PASSWORD \
--set auth.database=fruits_database \

What is the expected behavior?

I should be able to auth the user using the password defined as parameter

What do you see instead?

psql: error: connection to server at "postgresql" (10.96.93.222), port 5432 failed: FATAL: password authentication failed for user "healthy"

Additional information

No response

@cmoulliard cmoulliard added the tech-issues The user has a technical issue about an application label Apr 6, 2023
@github-actions github-actions bot added the triage Triage is needed label Apr 6, 2023
@javsalgar
Copy link
Contributor

Hi!

Thanks for opening the ticket. Could you change the title to something more descriptive?

@cmoulliard cmoulliard changed the title [bitnami/postgresql] [bitnami/postgresql] password authentication failed for a user/pwd specified using values: "auth.username" and "auth.pssword" Apr 6, 2023
@cmoulliard cmoulliard changed the title [bitnami/postgresql] password authentication failed for a user/pwd specified using values: "auth.username" and "auth.pssword" [bitnami/postgresql] password authentication failed for a user/pwd specified using values: "auth.username" and "auth.password" Apr 6, 2023
@cmoulliard
Copy link
Author

The problem I raised here hs been discussed part of this blog post here: https://medium.com/@hijessicahsu/deploy-postgres-on-minikube-5cd8f9ffc9c.

It is related to the fact that if a postgres instance has been created before, data still persist within the PVC and are not cleaned. If I delete the PVC, then I can access the DB with the user/password defined

kubectl run postgresql-client --rm --tty -i --restart='Never' --namespace db --image docker.io/bitnami/postgresql:14.5.0-debian-11-r35 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host postgresql -U healthy -d fruits_database -p 5432
If you don't see a command prompt, try pressing enter.

fruits_database=>

@javsalgar
Copy link
Contributor

Hi,

Yes, the issue is that PVC from StatefulSets don't get removed by default. Therfore letfovers from previous installations should be removed.

@cmoulliard
Copy link
Author

This is why I propose 2 changes within the documentation here: https://github.com/bitnami/charts/tree/main/bitnami/postgresql#uninstalling-the-chart

  1. Rephrase

"The command removes all the Kubernetes components but PVC's associated with the chart and deletes the release." -->
"The command removes all the Kubernetes components except the PVC's associated with the chart and deletes the release."

  1. Clearly warn the user

I propose to also add a note within the section to uninstall the helm chart and tell to the user that it is mandatory to delete the PVC when they will re-install the chart using a different database name, user and password !

@javsalgar
Copy link
Contributor

Hi,

Thanks for the input! Would you like to submit a PR updating the README?

@github-actions
Copy link

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Apr 26, 2023
@github-actions
Copy link

github-actions bot commented May 2, 2023

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@github-actions github-actions bot added the solved label May 2, 2023
@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2023
@osirisguitar
Copy link

The problem I raised here hs been discussed part of this blog post here: https://medium.com/@hijessicahsu/deploy-postgres-on-minikube-5cd8f9ffc9c.

It is related to the fact that if a postgres instance has been created before, data still persist within the PVC and are not cleaned. If I delete the PVC, then I can access the DB with the user/password defined

kubectl run postgresql-client --rm --tty -i --restart='Never' --namespace db --image docker.io/bitnami/postgresql:14.5.0-debian-11-r35 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host postgresql -U healthy -d fruits_database -p 5432
If you don't see a command prompt, try pressing enter.

fruits_database=>

Lifesaver, I was tearing my hair out over this :-D

@github-actions github-actions bot removed the solved label Oct 19, 2023
@jyorko
Copy link

jyorko commented Sep 20, 2024

So are you supposed to just delete the pvc and try to login again, im not getting it, i have had this error over and over and over again, not just on Kuberenetes with this specific helm chart but with docker as well. I have pruned my docker system, deleted entire namespaces and done fresh installs with fresh passwords, and still getting the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
postgresql stale 15 days without activity tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
Development

No branches or pull requests

5 participants