Services not able to connect to Postgresql when Istio Sidecar is enabled in Kubernetes


#1

Hi Team,
I am trying to enable istio sidecar injection with my containers running on kubernetes. The version on istio init container is proxy_init:1.0.3-gke.0 and of istio proxy is istio/proxyv2:1.0.3.
When i have enabled automatic injection in one of my namespace, my container do not create and got the error- decurtis.dxp.core.common.api.hibernate.config.PersistenceConfig$$EnhancerBySpringCGLIB$$cb4e7fa5.dataSource(<generated>) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) … 49 more Caused by: org.postgresql.util.PSQLException: The connection attempt failed. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:67) at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:216) at org.postgresql.Driver.makeConnection(Driver.java:406) at org.postgresql.Driver.connect(Driver.java:274) at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95) at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:101

Is something specific needs to be done so that services are able to connect to postgres. My postgres machine is running on AWS and not in same kubernetes cluster and without istio things are working fine.
Any help would be appreciated. Thanks in advance!


#2

I hope you already figured this out, but just in case you didn’t here is what you need to configure.

Hope this helps.
Regards, Pablo