Greetings!
Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.
It appears that you are facing a DNS resolution issue while attempting to connect to a PostgreSQL database hosted in a different subscription and virtual network from your Azure Kubernetes Service (AKS) cluster.
Could you please ensure the following:
- Azure Private Link creates a private DNS zone that maps the database's hostname to its private IP address. If the AKS cluster cannot resolve this hostname to the private IP, kindly ensure the following points to be addressed:
- Ensure that a private DNS zone is created for the PostgreSQL database and that it is linked to the virtual network where your AKS cluster resides.
- The private DNS zone should have an A record that maps the database's hostname (e.g.
xxxxxxxxxxxxxxx-flexible.postgres.database.azure.com
) to the private IP address of the private endpoint. - You can link a private DNS zone to one or more virtual networks by creating virtual network links. You can also enable the autoregistration feature to automatically manage the life cycle of the DNS records for the virtual machines that get deployed in a virtual network.
NOTE: If the private DNS zone is not linked to the VNet of your AKS cluster, you need to link it. This allows the AKS cluster to resolve the database's hostname to the private IP address.
If above is unclear and/or you are unsure about something add a comment below.
Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.
Regards,
Ganesh