Skip to content

AKS API Server Authorized IP Ranges Do Not Control Application Access

Interactive Diagram

새 탭 ↗

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.

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.

RequestDestinationNetwork settings to check first
kubectlKubernetes API serverAPI server authorized IP ranges and the public/private connection path
Application HTTPSAn endpoint exposed by a LoadBalancer, Ingress, or GatewayNSGs on that path and proxy or application access policies
VM SSH/RDPThe VM network interfaceSubnet and NIC NSGs
Blob accessA storage account endpointStorage firewall, IP and virtual network rules, and private endpoints
Image push/pullAn ACR registry endpointACR 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.

AKS management requests and application requests pass through separate access policies

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.

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.

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/32

If 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/32
203.0.113.20/32

In 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.

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.

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.

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 Allow to Deny, 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.

The following commands query configuration and check status. Make the subscription and target explicit first.

Terminal window
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 json

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.

Terminal window
kubectl --kubeconfig ./aks-lab-admin.yaml \
--request-timeout=10s get --raw=/readyz

For a private cluster, check private connectivity and DNS rather than an authorized IP list.

Find the application’s exposure path through its Service and Gateway or HTTPRoute. The following example applies to a cluster using Gateway API.

Terminal window
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/healthz

Replace 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.

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.

Terminal window
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 json

Compare 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.

Terminal window
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 json

defaultAction: 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.

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.