zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.39k stars 984 forks source link

Unhandled asynchronous exception, sending back 500 #1182

Closed softshipper closed 4 years ago

softshipper commented 4 years ago

Hi

I have created a microservice with https://quarkus.io/ and I am using Reative SQL Client to retrieve data from PostgreSQL server.

The PostgreSQL server is running on K8S cluster and it has been deployed with https://github.com/zalando/postgres-operator.

When the microservice requests some data from PostgreSQL server, the log from microservice shows the following error message:

2020-10-26 21:41:24,263 ERROR [org.jbo.res.res.i18n] (vert.x-eventloop-thread-1) RESTEASY002020: Unhandled asynchronous exception, sending back 500: io.vertx.pgclient.PgException: pg_hba.conf rejects connection for host "10.244.0.247", user "databaker", database "users", SSL off
    at io.vertx.pgclient.impl.codec.ErrorResponse.toException(ErrorResponse.java:29)
...

But when I forward the PostgreSQL server as localhost:

export PGMASTER=$(kubectl get pods -o jsonpath={.items..metadata.name} -l application=spilo,cluster-name=example-users-db,spilo-role=master)  
kubectl port-forward $PGMASTER 5432:5432

I receive the data as expected and do not get any errors. The SSL mode on the Reative SQL Client is disabled.

What am I doing wrong?

Thanks

Jan-M commented 4 years ago

Spilo only supports SSL and as the message clearly states your connection is refused with the parameters you use. So turn on SSL and you should be good to go.