[BUG] ALB Controller re-creates subnet association on restart, disabling Application Gateway for Containers (Azure CNI Overlay + /24 subnet)
[BUG] ALB Controller re-creates subnet association on restart, disabling Application Gateway for Containers (Azure CNI Overlay + /24 subnet)
Describe the bug
When the ALB Controller restarts (pod reschedule, node churn, upgrade, or leader election), it attempts to re-create the subnet association instead of recognizing the existing one. On a /24 subnet with Azure CNI Overlay, this fails with error code AppGwForContainersSubnetAssociationNotEnoughIPv4AddressesInSubnet, stating "At least 500 addresses are required" — even though the documentation specifies /24 (256 IPs) as the minimum.
This causes the Application Load Balancer to become disabled, requiring manual reconciliation to restore service.
Root Cause Analysis
On controller restart, the reconciliation loop does not perform an idempotent check for an existing association. Instead, it treats the association as a new provisioning request, which triggers the 500 IP requirement. Since the subnet is /24 (256 IPs) — which is the documented minimum — the request is rejected by the Azure backend, and the ALB enters a disabled state.
The /24 vs /23 Catch-22 (Azure CNI Overlay)
| Subnet Size | Result |
|---|---|
| /24 (256 IPs) | Fails: AppGwForContainersSubnetAssociationNotEnoughIPv4AddressesInSubnet — "At least 500 addresses are required" |
| /23 (512 IPs) | Fails: extensionIPRange prefix length too short (/23). Must be 24 or higher. |
This makes it impossible to use the managed deployment model with Azure CNI Overlay, as no valid subnet size exists that satisfies both requirements.
To Reproduce
- Deploy an AKS cluster with Azure CNI Overlay
- Deploy ALB Controller via Helm
- Create a
/24delegated subnet for AGC association (Microsoft.ServiceNetworking/trafficControllers) - Create an
ApplicationLoadBalancerCR referencing the/24subnet (managed deployment) - Wait for successful provisioning — association and frontend are created
- Restart the ALB Controller pods (e.g.,
kubectl rollout restart deployment/alb-controller -n azure-alb-system) - Observe: controller attempts to re-create the association → fails with
AppGwForContainersSubnetAssociationNotEnoughIPv4AddressesInSubnet→ ALB becomes disabled
Expected behavior
- On restart, the ALB Controller should detect the existing association and skip re-creation (idempotent reconciliation)
- The documented minimum subnet size of
/24should be sufficient for association creation - The ALB should not become disabled due to a controller restart
Environment
- ALB Controller version: 1.9.13 (also confirmed on 1.7.9, 1.8.9, 1.9.6)
- AKS Kubernetes version: 1.30.x
- Network plugin: Azure CNI Overlay
- Deployment strategy: Managed by ALB Controller
- Association subnet: /24 (256 IPs)
Error Details
ERROR CODE: AppGwForContainersSubnetAssociationNotEnoughIPv4AddressesInSubnet
{
"error": {
"code": "AppGwForContainersSubnetAssociationNotEnoughIPv4AddressesInSubnet",
"message": "Application Gateway for Containers: Subnet '...' does not have enough IPv4 addresses. At least 500 addresses are required to create Association '...' for this subnet."
},
"status": "Failed"
}
For /23 subnet:
error=failed to reconcile overlay resources: Overlay extension config azure-alb-system/alb-overlay-extension-config-XXXXXXXX failed with error: extensionIPRange prefix length too short (/23). Must be 24 or higher.
Current Workaround
- Manual reconciliation of the Application Load Balancer after each controller restart
- BYO deployment instead of managed — create the association and frontend manually in Azure, reference via
alb.networking.azure.io/alb-idannotation. This avoids the controller trying to reconcile the association on restart.
Related Issues
- #5490 — HTTPRoutes become unreachable when ALB Controller is restarted (controller deprovisions frontends on restart)
- #5486 — ALB Controller informer cache fails to sync ApplicationLoadBalancer CR after leader election
- #5310 — ALB Controller restarting sporadically (panic in
processApplicationLoadBalancersreconciler)
External Reference
- Blog post documenting the /24 vs /23 catch-22 with Azure CNI Overlay: https://blog.teknews.cloud/kubernetes/aks/network/2025/09/26/Troubleshooting_Application_Gateway_for_Containers.html
Impact
- Production downtime on every ALB Controller restart
- No valid subnet size exists for managed deployment + Azure CNI Overlay
- Documentation states /24 is sufficient, but the backend requires 500 IPs — this is a docs vs backend mismatch
This appears to be a separate issue from the 3 issues referenced. Please open a support case so we can track in parallel.
Thank you!
This issue has been automatically marked as stale because it has not had any activity for 30 days. It will be closed if no further activity occurs within 7 days of this comment. Please review @JackStromberg.
Hi there :wave: AKS bot here. This issue has been tagged as needing a support request so that the AKS support and engineering teams have a look into this particular cluster/issue.
Follow the steps here to create a support ticket for Azure Kubernetes Service and the cluster discussed in this issue.
Please do mention this issue in the case description so our teams can coordinate to help you. When you have created the support ticket, please add the case number as a comment to this issue to help us with tracking.
Thank you!
This issue will now be closed because it hasn't had any activity for 7 days after stale. @Harshithraj24 feel free to comment again on the next 7 days to reopen or open a new issue after that time if you still have a question/issue or suggestion.