How to create an AKS cluster where nodes don't have outbound internet access?

Balraj Kumar 0 Reputation points
2025-04-25T06:09:06.32+00:00

My Requirement - An AKS cluster with public authorised IP api server, but nodes do not have any outbound internet access (due to organisation security). I should be able to run kubectl commands from my local terminal.

Most suggested option is to create a public AKS with outbound type as userdefinedrouting and configure a firewall to allow outbound using Service Tags as required. But this comes with high cost of firewall. I want to avoid Firewall usage.

Network Isolated Cluster is there but in Preview and i feel this is perfect for my usecase.

Questions -

  1. My nodes outbound only needs to pull docker image and contact api server (no storage etc required). So if I use acr(cached for mcr images) private link and allow AzureCloud service tag in firewall, it still requires me to add application rule for AzureKubernetesService. Without this, nodes don't start. Why is it needed? What else my nodes need to communicate via internet apart from what I mentioned.
  2. In network isolated cluster(with api server vnet integration), if I have denied all outbound via NSG, nodes are still able to start. Here it does not need internet at all. Node version is also similar to what we see in public AKS nodes. ACR(with cached mcr) is accessed privately and api server also privately. How does it manage the requirements privately that was fulfilled by AzureKubernetesService service tag in public AKS through internet?
  3. If a network isolated cluster can start nodes without needing internet, then Can we use the same settings somehow to public aks and tell nodes to not contact internet for anything? I want this because network isolated cluster is not production ready. Or any way where I can avoid Firewall, no unnecessary internet access to nodes, and able to run kubectl from local pc.
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,385 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pramidha Yathipathi 430 Reputation points Microsoft External Staff
    2025-04-28T06:29:25.25+00:00

    Hi Balraj Kumar,

    You can use a combination of other Azure service tags to ensure that your AKS nodes can still communicate with necessary Azure-managed endpoints, like for public AKS clusters, use the AzureCloud service tag to allow outbound communication to Azure's public endpoints, including the AKS control plane, telemetry, and identity services. For private AKS clusters, where the control plane is external to your VNet, you must allow outbound access to the control plane's IP range.

    Why it's not available in NSG:

    Azure NSGs support a limited subset of service tags, mostly for layer 3/4 network filtering (IP-based).

    AzureKubernetesService, on the other hand, involves FQDN-based destinations (like telemetry endpoints, MSI, etc.), which require application-layer filtering (i.e., L7). NSG cannot inspect FQDNs — only IP addresses or IP prefixes, hence it does not support this service tag.

    How to allow AzureKubernetesService traffic without Firewall?

    To allow AzureKubernetesService egress without NSG support, you need to route outbound traffic through a NAT Gateway, then use a custom route table to:

    • Force all egress from your AKS subnet to go through the NAT Gateway.

    • Ensure the NAT Gateway’s public IP(s) are allowed to access Azure’s endpoints.

    While NSGs can't allow AzureKubernetesService, traffic still flows if not explicitly blocked and routed via NAT Gateway.

    For detailed guidance on implementing this setup, refer to the following Microsoft documentation:

    https://learn.microsoft.com/en-us/azure/aks/nat-gateway

    https://learn.microsoft.com/en-us/azure/aks/egress-outboundtype

    Recommendation (without Azure Firewall):

    1. Use Outbound Type: UserDefinedRouting, this disables default SNAT and lets you define your own egress path.
    2. Create NAT Gateway with static public IP, attach it to your AKS subnet.
    3. Private ACR (with Private Link) – done, this handles image pulling without public internet.
    4. Enable only outbound via NAT Gateway for necessary Azure services (i.e., don’t explicitly block those outbound IPs/domains)
    5. In NSG:

    Deny all outbound except: To your NAT Gateway route and Private ACR.

    No need to add AzureKubernetesService — just avoid blocking it

    1. Control domains (optional):

    If you must restrict domains:

    Use Azure Firewall DNS-based filtering or deploy custom DNS + Proxy that allows only required AKS control plane domains (complex and fragile)

    I hope this information is helpful, please click "Upvote" on the post to let us know.

    Thank You.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.