#PostgreSQL connection timeouts when running app clustered on Kubernetes

4 messages · Page 1 of 1 (latest)

white laurel
#

I have a strange problem. We've deployed an phoenix app on a K8s cluster with an external PostgreSQL database. When i deploy more than one pod, only one pod gets database connections. When i deploy more, all other pods running the app are returning the following error message:

12:07:35.140 [error] Postgrex.Protocol (#PID<0.3064.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (84.201.X.X:5432): timeout

For me it sounds like some problem with the database server, but our service provider claims, that this is a software related problem. The server has a limit of 100 connections, no limit per user. Our pool configuration is 20 connections. I tried to increase the timeout values, but without success. Have any of you ever had this kind of problem?

dreamy heron
#

Can you ping your DB from your k8s node?

#

Because both can work perfectly fine while running in separate networks and not be visible from each other

white laurel
#

Yes, the database is reachable.