简体   繁体   中英

unable to connect to Azure Postgres from Azure aks

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 su.net 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?

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM