Cannot Connect to PosgresDB Flexible Server From in Private AKS
Hi all,
I am experiencing an issue with connecting to a PostgreSQL database from a private AKS cluster. The AKS and the database are located in two different virtual networks and subscriptions.
To debug the connection, I created a pod using the following command:
kubectl run -i --
However, when I try to connect to the database using common psql
commands, I receive the following error:
psql: error: could not translate host name "xxxxxxxxxxxxxxxxxxx-flexible.postgres.database.azure.com" to address: Name or service not known
The connection is successful when the database is in the same virtual network as the AKS cluster. However, it fails when the database is in a different subscription.
Upon investigation, I found that running nslookup
in a pod of the AKS cluster returns a result missing the IP address of the database’s private endpoint. Is this normal behavior? When I perform the same action with other databases located in the same subscription as the AKS, the IP address values are returned correctly. The only difference is that the problematic database is in a different subscription
Any help with this would be greatly appreciated.
Thanks,
Thang