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

Unable to connect to cluster from application but able to connect from within application container when tried manually #953

Open
preetam-uptimeai opened this issue Dec 4, 2023 · 0 comments

Comments

@preetam-uptimeai
Copy link

preetam-uptimeai commented Dec 4, 2023

I have setup spilo cluster and I am able to connect to it from within the container hosting the cluster.

I have a deployment file which hosts a nodejs application and tries to connect to the psql cluster.

When i exec into the nodejs container and run psql -h postgresql-cluster.default.svc.cluster.local -U postgres and enter password, I am able to connect to db. (postgresql-cluster.default.svc.cluster.local is the name of the CLusterIP service which exposes the psql cluster)

But when I try to connect to db from nodejs application using 'pg' npm module with same host, user and password, I get the following error

error: pg_hba.conf rejects connection for host "10.244.4.39", user "postgres", database "uptime", no encryption

Below is the content fro pg_hba.config file

cat pg_hba.conf
Do not edit this file manually!
It will be overwritten by Patroni!
local all all trust
hostssl all +zalandos 127.0.0.1/32 pam
host all all 127.0.0.1/32 md5
hostssl all +zalandos ::1/128 pam
host all all ::1/128 md5
local replication standby trust
hostssl replication standby all md5
hostnossl all all all reject
hostssl all +zalandos all pam
hostssl all all all md5

exit

Please guide me through

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

No branches or pull requests

1 participant