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

FATAL: password authentication failed for user "postgres" #554

Closed
bhargavsunkara9 opened this issue Jan 21, 2022 · 17 comments
Closed

FATAL: password authentication failed for user "postgres" #554

bhargavsunkara9 opened this issue Jan 21, 2022 · 17 comments
Labels

Comments

@bhargavsunkara9
Copy link

Installed sentry using helm. chart version - 12.0 and app version - 21.8.0. The ingress is set. But when i try to access the web URL i get 502 bad gateway. So i checked the logs of sentry-web pod and i get the below error:
File "/usr/local/lib/python3.6/site-packages/psycopg2/init.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL: password authentication failed for user "postgres"

@f3nsgs
Copy link

f3nsgs commented Jan 24, 2022

Similar behaviour. Either immediately after launch, or the next day.

@sfc-gh-pkommini
Copy link
Contributor

@bhargavsunkara9 Did you pass values for the postgresqlPassword and postgresqlUsername?

@f3nsgs
Copy link

f3nsgs commented Jan 26, 2022

@bhargavsunkara9 @sfc-gh-pkommini After studying the configurations, everything became clear. If I understand everything correctly. If postgresqlpassword is not specified in the Values ​​file of the Postgres chart, a random set is substituted.
(_helpers.tpl in postgres chart)
postgres_helpers
Sentry web, in turn, takes the password from there (sentry-web deployment)
sentry_web_deployment

Do I understand correctly that I cannot set the password value for Postgresql from the Values file ​​from sentry chart?

@bhargavsunkara9
Copy link
Author

@bhargavsunkara9 Did you pass values for the postgresqlPassword and postgresqlUsername?

No. The password will be substituted by creating a random one. when i template the chart, it shows the same and i dont see any issue. The pods are available and running, secret is created, but i get 502 badgateway when i access the URL.

@weiyentan
Copy link

weiyentan commented Feb 3, 2022

@bhargavsunkara9 i get the same error as well on version 13.01
i checked the logs of the sentry-web container and got this as an error:

django.db.utils.OperationalError: FATAL:  password authentication failed for user "postgres"

Not too long ago...monday my time...sunday yours the helm chart was working. When did yours happen?

@bhargavsunkara9
Copy link
Author

@bhargavsunkara9 i get the same error as well on version 13.01 i checked the logs of the sentry-web container and got this as an error:

django.db.utils.OperationalError: FATAL:  password authentication failed for user "postgres"

Not too long ago...monday my time...sunday yours the helm chart was working. When did yours happen?

I got the exact error. And the only solution for this is to uninstall the helm deployment, make sure all sentry objects, jobs, deployments etc are deleted and FINALLY delete the PVCs. Do the fresh install and it may work.
kubectl delete pvc --all -n ( apply this only if you have your own namespace else delete manually)

Somehow the passwords are being stored in the PVCs and this is the reason i was getting password authentication errors.
Hope this helps!

@weiyentan
Copy link

Thanks @bhargavsunkara9 . This helped. It didn't solve my redis slave problem "no route to host". For some reason the default install references it incorrectly and creates a loopback crash. Solved it. I'll add that to the other issue I had. What you said does makes sense. Thank you for the help

@jemand771
Copy link

while this might not be relevant for the author of this issue, I got this error in a slightly different way:
I had postgresqlPassword set to some value but wanted to change it - apparently that's not possible after the initial install (hence the failing auth)

@weiyentan
Copy link

@jemand771 I know why. There is a secret created after the initial install.

@bhargavsunkara9
Copy link
Author

Thanks @bhargavsunkara9 . This helped. It didn't solve my redis slave problem "no route to host". For some reason the default install references it incorrectly and creates a loopback crash. Solved it. I'll add that to the other issue I had. What you said does makes sense. Thank you for the help

Glad it helped! But this worries me as well. In case of future upgrades we cannot afford to do the uninstall and install from the scratch for a minor change in code. And of course a lot of time is wasted for this. There must be a solution to make the upgrade work :-/

@JVMartin
Copy link

There is something seriously wrong with this helm chart.

The secret it creates has 2 keys in it:

> kubectl get secret sentry-sentry-postgresql -o yaml
data:
  postgresql-password: <pass>
  postgresql-postgres-password: <different pass>

These 2 are different, why are there 2 of them

@Mokto
Copy link
Contributor

Mokto commented Mar 30, 2022

This issue is stale because it has been open for 30 days with no activity.

@Mokto Mokto added the stale label Mar 30, 2022
@Mokto
Copy link
Contributor

Mokto commented Apr 13, 2022

This issue was closed because it has been inactive for 14 days since being marked as stale.

@Mokto Mokto closed this as completed Apr 13, 2022
@JVMartin
Copy link

@Mokto This issue is still a huge problem

@Mokto
Copy link
Contributor

Mokto commented Apr 14, 2022

I don't agree.

This is properly documented and there are already tons of discussions about it on this repo.

@prog76
Copy link

prog76 commented Jun 29, 2023

I didn't find the working configuration in the documentation, so for those who faced this issue, I would document the solution here:
helm values for sentry helm chart version 19.3.0:

postgresql:
  existingSecret: postgres
  existingSecretKey: postgres-password
  auth:
    existingSecret: postgres
    secretKeys:
      adminPasswordKey: postgres-password #it's default, but FYI

and you need a secret

kind: Secret
metadata:
  name: postgres
  namespace: sentry
stringData:
  postgres-password: "123admin"

@ns-mjagtap
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants