An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
Hello Le Van Khoa,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that your AKS pods/nodes cannot connect to resources in the peered VNet, while ordinary VMs in the same AKS VNet can connect successfully.
The issue is that AKS traffic does not necessarily use the same source IP path as the working VM. Depending on the AKS network mode, traffic from pods to a peered VNet may appear as the AKS node subnet IP or as the pod subnet IP. Therefore, the target-side NSG, firewall, route table, private endpoint rules, or application allowlist must allow the actual AKS source, not only the subnet used by the successful test VM. - https://learn.microsoft.com/en-us/azure/aks/concepts-network-azure-cni-overlay, and https://learn.microsoft.com/en-us/azure/aks/concepts-network-cni-overview gives more insight.
What you can do to fix is to:
- Confirm the AKS network mode and identify whether the target should allow the AKS node subnet or pod subnet.
- Test DNS resolution from inside a pod, not only from a VM.
- If DNS fails, configure AKS CoreDNS to forward the private DNS zone to the Azure DNS Private Resolver inbound endpoint.
- If DNS resolves but connectivity fails, allow the AKS node subnet, and the pod subnet if using flat Azure CNI, on the target NSG/firewall/private endpoint path.
- Validate effective routes and NSG rules on the AKS node NIC and target-side subnet.
- Escalate to Azure Support via Azure portal or Priority Customer Support only if the configuration is correct and packet/DNS evidence shows platform-side failure.
After allowing the correct AKS source subnet and ensuring CoreDNS forwards the private namespace to the Azure DNS Private Resolver inbound endpoint, the AKS pods should resolve the private FQDN and connect to the private resource through the peered VNet without needing public access or unnecessary architecture changes. Azure DNS Private Resolver supports forwarding queries through inbound endpoints, and AKS CoreDNS customization is the supported way to add custom DNS forwarding for pods. - https://learn.microsoft.com/en-us/azure/dns/private-resolver-endpoints-rulesets, https://learn.microsoft.com/en-us/azure/dns/dns-private-resolver-overview, and https://learn.microsoft.com/en-us/azure/aks/coredns-custom.
Use the associated resource links above and below for more reading and steps:
I hope this is helpful. Please! Do not hesitate to let me know if you have any other questions, steps or clarifications.
Please do not close the thread by upvoting and accepting the answer if any part of it is helpful.