How to fix Application Gateway Ingress Controller error in Kubernetes
AGIC (Application Gateway Ingress Controller) errors occur when the controller fails to synchronize Kubernetes ingress resources with Azure Application Gateway. This results in ingress resources not being applied to the gateway, causing 502 Bad Gateway errors. Common causes include permission issues, incorrect ingress annotations, or AGIC pod failures.
Quick fix
Fixes Application Gateway Ingress Controller error
kubectl get pods -n kube-system | grep agic
kubectl logs -n kube-system <agic-pod-name>- Check AGIC pod status and logs
- Verify ingress annotations
- Check Application Gateway status
- Validate identity permissions
kubectl get pods -n kube-system | grep agickubectl logs -n kube-system <agic-pod-name>Application Gateway Ingress Controller error
What this error means
This error indicates that AGIC, the controller responsible for bridging Kubernetes ingress resources and Azure Application Gateway, encountered a problem. AGIC watches your cluster for ingress resource changes and automatically configures the Application Gateway to route traffic accordingly. When AGIC fails, ingress definitions are not applied to the gateway, meaning traffic routes are not created and your applications become unreachable.
Typical symptoms
- HTTP requests to ingress endpoints return 502 Bad Gateway or timeout
- AGIC controller pod is stuck in CrashLoopBackOff or in non-ready state
- Ingress resources are created but not reflected in Application Gateway configuration
- New pod IPs are not syncing to Application Gateway backend pools
- Routing rules are not created for defined ingress resources
- Pod health checks are failing due to missing IP assignment from the gateway
Common causes
- AGIC pod not running due to startup failures or resource constraints
- Missing or incorrect service principal credentials configured in AGIC deployment
- Managed identity lacking Contributor access to the Application Gateway resource
- Managed identity lacking Reader access to the Application Gateway resource group
- Missing required ingress annotation: kubernetes.io/ingress.class: azure/application-gateway
- AGIC not configured to watch the namespace where ingress resources exist
- Using NGINX-specific annotations instead of AGIC-compatible ones
- Application Gateway operational state not Running (requires restart)
- Network connectivity issues between AKS cluster and Application Gateway
- Version incompatibility between AGIC and AAD Pod Identity components
How to fix "Application Gateway Ingress Controller error"
First, verify the AGIC controller pod is running:
kubectl get pods -n kube-system | grep agic
kubectl logs -n kube-system <agic-pod-name>Ensure your ingress resources have the correct AGIC annotation:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-app
annotations:
kubernetes.io/ingress.class: azure/application-gatewayVerify the Application Gateway is in Running state:
az network application-gateway show --name <GATEWAY_NAME> --resource-group <RG_NAME> --query "operationalState"If using managed identity, verify it has required roles:
IDENTITY_ID=$(az aks show --resource-group <RG> --name <CLUSTER> --query "identity.principalId" -o tsv)
az role assignment list --assignee $IDENTITY_IDVerify AGIC is configured to watch your namespaces:
helm get values ingress-azure -n kube-systemEnable verbose logging to see what AGIC is doing:
kubectl set env deployment/ingress-azure -n kube-system APPGW_LOG_LEVEL=DebugTest that your ingress endpoints work:
AG_IP=$(az network public-ip show --name <AG_PUBLIC_IP_NAME> --resource-group <RG_NAME> --query ipAddress -o tsv)
curl -I -H "Host: myapp.example.com" http://$AG_IPAdvanced notes
AGIC can be deployed as an AKS cluster add-on or via Helm. Switching between methods requires removing all existing resources to prevent conflicts. Managed identity replication in Entra ID can take up to 1 minute; wait before assigning roles. AAD Pod Identity (deprecated) can cause version conflicts with AGIC versions before 1.2.0-rc2.
Frequently asked questions
- What does "Application Gateway Ingress Controller error" mean?
- This error indicates that AGIC, the controller responsible for bridging Kubernetes ingress resources and Azure Application Gateway, encountered a problem. AGIC watches your cluster for ingress resource changes and automatically configures the Application Gateway to route traffic accordingly. When AGIC fails, ingress definitions are not applied to the gateway, meaning traffic routes are not created and your applications become unreachable.
- How do I fix "Application Gateway Ingress Controller error"?
- AGIC (Application Gateway Ingress Controller) errors occur when the controller fails to synchronize Kubernetes ingress resources with Azure Application Gateway. This results in ingress resources not being applied to the gateway, causing 502 Bad Gateway errors. Common causes include permission issues, incorrect ingress annotations, or AGIC pod failures.
- What causes "Application Gateway Ingress Controller error"?
- AGIC pod not running due to startup failures or resource constraints Missing or incorrect service principal credentials configured in AGIC deployment Managed identity lacking Contributor access to the Application Gateway resource
- Is the "Application Gateway Ingress Controller error" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐Kubernetes Official Documentation
- ๐Microsoft Docs: ingress controller overview(Official Docs)
- ๐Microsoft Docs: ingress controller troubleshoot(Official Docs)
- ๐
- ๐ฌStack Overflow: azure application gateway ingress controller(Stack Overflow)