'How to connect to Postgresql database using Spring data reactive on Kubernetes?
I am able to connect to Postgresql database using Spring Data Reactive locally and using my H2 in-memory database for local testing. However, when I deploy the app on a Kubernetes cluster with a Postgresql database cluster I keep getting the following error:
Caused by: io.r2dbc.postgresql.ExceptionFactory$PostgresqlAuthenticationFailure: pg_hba.conf rejects connection for host "10.244.2.232", user "myuser", database "account", no encryption
at io.r2dbc.postgresql.ExceptionFactory.createException(ExceptionFactory.java:75) ~[r2dbc-postgresql-0.8.10.RELEASE.jar!/:0.8.10.RELEASE]
at io.r2dbc.postgresql.ExceptionFactory.handleErrorResponse(ExceptionFactory.java:111) ~[r2dbc-postgresql-0.8.10.RELEASE.jar!/:0.8.10.RELEASE]
at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:103) ~[reactor-core-3.4.13.jar!/:3.4.13]
The following is my application.yml that contains the spring r2dbc url:
spring:
r2dbc:
url: r2dbc:postgresql://${POSTGRES_SERVICE}/${POSTGRES_DBNAME}
username: ${POSTGRES_USERNAME}
password: ${POSTGRES_PASSWORD}
I do have another Springboot app that is not reactive which can connect to a another Postgresql cluster.
Is there a specific param that I need to send to my query string?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
