AKS API Server Authorized IP Ranges Do Not Control Application Access
If you restrict the API server IP ranges in Azure Kubernetes Service (AKS), will applications deployed to the cluster accept requests only from those addresses too? Although kubectl and a browser may target the same cluster, they connect to different endpoints. The API server allowlist applies to Kubernetes management requests.
In a development AKS environment, access controls for the API server, VMs, registry, and storage were adjusted together. That raised a question: āCan services still be used as before after changing the API server allowlist?ā Answering it requires separating request destinations rather than looking for a single allowlist.
At a glance: which entrance does the request use?
Section titled āAt a glance: which entrance does the request use?ākubectl uses the entrance for managing the cluster. An applicationās HTTPS address is an entrance for using the service. VM SSH and storage Blob requests have their own entrances.
The same source IP can appear on several allowlists. Adding it to one does not automatically add it to the others.
| Request | Destination | Network settings to check first |
|---|---|---|
kubectl | Kubernetes API server | API server authorized IP ranges and the public/private connection path |
| Application HTTPS | An endpoint exposed by a LoadBalancer, Ingress, or Gateway | NSGs on that path and proxy or application access policies |
| VM SSH/RDP | The VM network interface | Subnet and NIC NSGs |
| Blob access | A storage account endpoint | Storage firewall, IP and virtual network rules, and private endpoints |
| Image push/pull | An ACR registry endpoint | ACR network rules and the public/private connection path |
Network access and authorization are separate as well. An allowed IP must still pass Kubernetes RBAC, application authentication, storage permissions, or ACR authentication.
Figure 1. Original diagram comparing the policy boundaries for API management and application requests. The network configuration for an application depends on how it is exposed. Based on AKS API server authorized IP ranges and Azure NSG evaluation.
What API server authorized IP ranges control
Section titled āWhat API server authorized IP ranges controlāauthorizedIPRanges restricts the source IP ranges of requests entering the AKS API server. kubectl, management tools, and API clients use this path.
For example, adding an administratorās public egress IP allows API server connectivity from that location. This does not also allow application HTTPS, VM SSH, or Blob requests.
An API request can connect successfully but receive Forbidden because the identity lacks permission. Check the identity and RBAC before adding more IP ranges. Distinguish a request that times out from one that receives an API authorization error.
0.0.0.0/32 is a standalone special value
Section titled ā0.0.0.0/32 is a standalone special valueāIn ordinary CIDR notation, 0.0.0.0/0 means all IPv4 addresses. 0.0.0.0/32 denotes a single address. These values are not equivalent.
AKS interprets 0.0.0.0/32 specially in its API server authorized IP ranges. According to Microsoftās documentation, it is a placeholder allowing the clusterās Standard SKU Load Balancer outbound public IP to access the API server.
This special value cannot be combined with other authorized IP addresses or CIDRs. The standalone configuration that allows only that outbound IP is:
0.0.0.0/32If administrator access must be retained, do not use the special value. Specify both the administratorās source address and the clusterās actual outbound public IP. The following addresses are documentation examples; replace them with the administratorās source IP and the clusterās retrieved outbound IP.
198.51.100.10/32203.0.113.20/32In this case, a change request combining administrator IPs with 0.0.0.0/32 was rejected. The actual outbound IP of each cluster was checked, and the earlier configuration listing administrator IPs and those addresses explicitly was restored. Input validation was added to the infrastructure code to reject the same mixed list.
Check the outbound IP of each cluster and update the explicit allowlist if the address changes. Putting 0.0.0.0/32 in an NSG or storage firewall does not bring the AKS-specific interpretation with it.
It also does not enable outbound connectivity itself. It allows requests originating from that outbound IP to enter the API server.
Check application access along its exposed path
Section titled āCheck application access along its exposed pathāApplication requests follow the applicationās domain and port. First determine whether it uses a LoadBalancer Service directly or goes through an Ingress or Gateway. Gateway API route configuration is covered separately in Envoy Gateway routing verification.
IP filters and proxy settings on the application path are independent of the API server allowlist. Restricting the API server does not establish that the application is restricted.
Likewise, blocked kubectl access does not establish that the application is down. Send a request to the application address and determine whether the problem is in DNS, TLS, routing, or authentication.
Subnet and NIC NSGs are both evaluated
Section titled āSubnet and NIC NSGs are both evaluatedāA network security group (NSG) contains rules that allow or deny Azure network traffic. Separate NSGs can be associated with a VMās subnet and network interface (NIC).
When both are associated, inbound traffic is evaluated against the subnet NSG first, then the NIC NSG. It must pass both to reach the VM. An Allow in one does not override a Deny in the other. Within each NSG, the first matching rule is applied in priority order.
Therefore, automation that adds an SSH allow rule to the NIC NSG cannot provide access if a newly associated subnet NSG blocks it. āManages NSGsā is less useful than knowing which NSG and which rules the automation manages.
This describes NSG evaluation along that network path. For authentication to an applicationās administration UI, configure a separate authentication layer such as nginx Sidecar authentication.
Case: separate the individual security changes
Section titled āCase: separate the individual security changesāThe caseās change history recorded these operations separately.
- Updated allowed source addresses for VM SSH and RDP
- Created and associated an NSG with the application subnet
- Updated API server authorized IP ranges on two AKS clusters
- Changed the default network action on ACR and two storage accounts from
AllowtoDeny, with IP rules configured - Updated an AI service accountās network access policy and IP rules
These can all be described as ārestricting allowed IPs,ā but they affect different targets. For example, a storage firewall change can affect Terraform backend access, and an ACR restriction can affect image push/pull depending on the connection path. Checking only the API server allowlist does not reveal these effects.
The confirmed observations are configuration changes on individual resources. Whether existing clients still work after those changes must be checked per path.
Verification: test four paths separately
Section titled āVerification: test four paths separatelyāThe following commands query configuration and check status. Make the subscription and target explicit first.
SUBSCRIPTION_ID="<subscription-id>"RESOURCE_GROUP="rg-aks-lab"AKS_NAME="aks-lab"
az aks show \ --subscription "$SUBSCRIPTION_ID" \ --resource-group "$RESOURCE_GROUP" \ --name "$AKS_NAME" \ --query "{fqdn:fqdn,privateFqdn:privateFqdn,access:apiServerAccessProfile,outboundType:networkProfile.outboundType,loadBalancerSku:networkProfile.loadBalancerSku}" \ --output json1. API server: match the destination and source
Section titled ā1. API server: match the destination and sourceāCheck whether the API server is public or private, then compare the actual public egress IP of the client location with the authorized ranges. Specify the authenticated cluster kubeconfig so that success against another cluster is not mistaken for success here.
kubectl --kubeconfig ./aks-lab-admin.yaml \ --request-timeout=10s get --raw=/readyzFor a private cluster, check private connectivity and DNS rather than an authorized IP list.
2. Application: request the exposed address directly
Section titled ā2. Application: request the exposed address directlyāFind the applicationās exposure path through its Service and Gateway or HTTPRoute. The following example applies to a cluster using Gateway API.
kubectl --kubeconfig ./aks-lab-admin.yaml \ get service,gateway,httproute --all-namespaces
curl --connect-timeout 5 --max-time 10 \ --output /dev/null --write-out '%{http_code}\n' \ https://app.example.com/healthzReplace the domain and health path with the actual target. If API access is blocked, an application address retained earlier can still be tested independently.
An HTTP 401 or 403 means that some HTTP server responded to the request. Check application or proxy authentication and access policies as well. Do not treat every timeout, DNS failure, or TLS error as the same IP filtering issue.
3. VM: inspect the NICās effective NSGs
Section titled ā3. VM: inspect the NICās effective NSGsāDo not stop at finding a rule named Allow-SSH. Check the NSGs actually associated with the subnet and NIC. The following example queries effective NSGs on the NIC while the target VM is running.
NIC_ID="/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Network/networkInterfaces/nic-lab"
az network nic list-effective-nsg \ --subscription "$SUBSCRIPTION_ID" \ --ids "$NIC_ID" \ --output jsonCompare source, destination, port, protocol, and rule priority together. SSH and RDP use different ports, so check them separately.
4. Storage and ACR: separate firewall checks from authentication
Section titled ā4. Storage and ACR: separate firewall checks from authenticationāQuery the network configuration of the Blob storage account and ACR. These commands do not retrieve keys or tokens.
az storage account show \ --subscription "$SUBSCRIPTION_ID" \ --resource-group "$RESOURCE_GROUP" \ --name "stlabartifacts" \ --query "{publicNetworkAccess:publicNetworkAccess,networkRules:networkRuleSet}" \ --output json
az acr show \ --subscription "$SUBSCRIPTION_ID" \ --resource-group "$RESOURCE_GROUP" \ --name "acrlabimages" \ --query "{publicNetworkAccess:publicNetworkAccess,networkRules:networkRuleSet}" \ --output jsondefaultAction: Deny means that the network rules apply a default deny action. Check private endpoints, exceptions, and allow rules too. Do not read it as equivalent to publicNetworkAccess: Disabled.
Then test an authorized read from the actual client location. A valid token alone does not pass the firewall. For images, distinguish the deployment operatorās push path from the nodesā pull path.
Scope and decision criteria
Section titled āScope and decision criteriaāThe API server authorized IP ranges discussion assumes a public API endpoint and Standard SKU Load Balancer configuration. The feature cannot be used with private clusters. For NAT Gateway or user-defined routing, identify the actual outbound path first.
Using an explicit outbound IP instead of the special value still targets only the API server. It does not automatically update allowed IPs on other resources or replace application authentication and authorization. The case confirmed access policy changes and correction of the mixed list, not an apply of the restored infrastructure code or successful connectivity from every client afterward.
After a security change, record results by API, application, VM, and storage destination rather than asking only whether āAKS is healthy.ā Knowing which setting applies to which request also narrows connectivity troubleshooting.