0
postgres@name-prod-psql-197fb74f68-9psrh:/$ psql "host=name-prod.postgres.database.azure.com port=5432 dbname=prod user=user password=XXX"

psql: error: could not connect to server: Connection timed out
    Is the server running on host "name-prod.postgres.database.azure.com" (10.110.0.4) and accepting
    TCP/IP connections on port 5432?

If I run traceroute inside the POD

[root@utils /]# traceroute name-prod.postgres.database.azure.com
traceroute to name-prod.postgres.database.azure.com (10.110.0.4), 30 hops max, 60 byte packets
 1  10-240-0-226.prometheus-node-exporter.prometheus.svc.cluster.local (10.240.0.226)  0.037 ms  0.019 ms  0.009 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

It used to work for 8 days and then suddenly stopped.

  • Postgres is placed in subnet 10.110.0.0/16
  • Aks in prod-private-eks 10.240.0.0/16 with Microsoft.Sql service endpoint added

What could be the issue?

DmitrySemenov
  • 9,204
  • 15
  • 76
  • 121
  • did you check this connection poolers you can use with PostgreSQL ie PgBouncer. It is lightweight containerized PgBouncer that can be used in a sidecar to pool connections from AKS to Azure Database for PostgreSQL : https://learn.microsoft.com/en-us/azure/postgresql/concepts-aks – RahulKumarShaw Sep 13 '21 at 08:45
  • The new release of PgBouncer contains a number of new features and important fixes Please check this : http://www.pgbouncer.org/2021/08/pgbouncer-1-16-0 – RahulKumarShaw Sep 13 '21 at 08:46

1 Answers1

-1

Would suggest you to Open a Firewall Port for PostgreSQL if haven’t

Please refer this document to how to Open a Port in Windows Defender Firewall:

https://manifold.net/doc/mfd9/open_a_firewall_port_for_postgresql.htm

In PostgreSQL’s case it’s typical to use port 5432 if it is available. If it isn’t, most installers will choose the next free port, usually 5433.

Reference: postgresql port confusion 5433 or 5432?

RahulKumarShaw
  • 4,192
  • 2
  • 5
  • 11