how to get hold of the azure kubernetes cluster outbound ip address
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
In Azure Kubernetes Service, the phrase "outbound IP" means the public address used when pods or nodes reach services outside the cluster. You usually need that address for firewall allowlists, partner API access, or audit work. The important detail is that AKS does not always use the same egress mechanism, so the correct command depends on the cluster's outboundType.
Start by Checking the Outbound Type
Do not assume every AKS cluster uses a load balancer for egress. Newer clusters can use a managed NAT gateway, a user-assigned NAT gateway, user-defined routing, or other egress patterns.
Check the current setting first:
Typical results include loadBalancer, managedNATGateway, userAssignedNATGateway, and userDefinedRouting.
That one value changes where you should look next. If you skip this step, it is easy to inspect the wrong Azure resource and allowlist an IP that your workloads never use.
Load Balancer Clusters
For clusters that use loadBalancer, AKS exposes the effective outbound public IP resources in the load balancer profile. First get the resource IDs, then resolve those IDs to actual IPv4 addresses.
That returns one or more Azure resource IDs. Convert them to the concrete IP values:
If you see multiple addresses, that is normal. AKS can distribute outbound connections across more than one public IP.
NAT Gateway Clusters
If the cluster uses managedNATGateway or userAssignedNATGateway, the outbound IPs come from the NAT gateway profile instead of the load balancer profile. The query path is different, but the pattern is the same.
This is the most direct way to answer the operational question, which is not "what Azure resource exists" but "which public IPs does the cluster actually use for egress right now".
A compact version that branches on outboundType is often useful in runbooks:
When AKS Is Not the Source of Truth
If outboundType is userDefinedRouting, AKS itself is not the final owner of the public egress IP. In that model, outbound traffic is usually sent to an Azure Firewall, network virtual appliance, or another custom path defined by the route table.
In that case, use AKS only to confirm the mode, then inspect the real egress device. For example, if a subnet is attached to a NAT gateway, find that gateway from the subnet and then inspect its public IPs:
The operational rule is simple: the outbound IP belongs to the component that performs SNAT. Sometimes that is the AKS-managed load balancer. Sometimes it is a NAT gateway or firewall outside the managed cluster resource.
Common Pitfalls
- Looking only at the Kubernetes
Serviceexternal IP and assuming it is also the outbound IP. - Querying the load balancer profile even though the cluster uses a NAT gateway or user-defined routing.
- Allowlisting one public IP when the cluster actually uses several effective outbound IPs.
- Forgetting that changing
outboundTypechanges egress addresses and can break firewall rules. - Reading the Azure portal load balancer resource directly after a cluster change instead of querying AKS first.
Summary
- Start with
az aks show --query "networkProfile.outboundType". - For
loadBalancer, readnetworkProfile.loadBalancerProfile.effectiveOutboundIPs. - For NAT gateway based clusters, read
networkProfile.natGatewayProfile.effectiveOutboundIPs. - Convert resource IDs to actual addresses with
az network public-ip show. - For
userDefinedRouting, inspect the real egress device because AKS is not the final source of truth.
Related reading
- How to get HTTP/2 working in a Kubernetes cluster using ingress-nginx
- How to get k8s master logs on EKS?
- How to get Kubernetes cluster name from K8s API
- How to get kubernetes service account access token using fabric8 java client?
- How to get input file name as column in AWS Athena external tables
- How to get public URL after uploading image to S3?
- How to get http headers in flask?
- How to get HTTP response code for a URL in Java?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.