|
| 1 | +--- |
| 2 | +title: Troubleshoot Application Gateway Ingress Controller Connectivity Issues |
| 3 | +description: Provides troubleshooting guidance for connectivity issues related to the Application Gateway Ingress Controller in Azure Kubernetes Service. |
| 4 | +ms.reviewer: claudiogodoy |
| 5 | +ms.service: azure-kubernetes-service |
| 6 | +ms.custom: sap:Load balancer and Ingress controller |
| 7 | +ms.date: 05/24/2025 |
| 8 | +--- |
| 9 | +# Troubleshoot Application Gateway Ingress Controller connectivity issues |
| 10 | + |
| 11 | +The [Application Gateway Ingress Controller (AGIC)](/azure/application-gateway/ingress-controller-overview) is a Kubernetes application that enables [Azure Kubernetes Service (AKS)](/azure/aks/what-is-aks) users to use Azure's native Application Gateway L7 load-balancer to expose cloud software to the internet. |
| 12 | + |
| 13 | +This article provides step-by-step guidance to troubleshoot AGIC connectivity issues effectively. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +Before you start, make sure that you have the following tools installed: |
| 18 | + |
| 19 | +- **Azure CLI**: Follow the [installation guide](/cli/azure/install-azure-cli). |
| 20 | +- **Kubernetes CLI (`kubectl`)**: Use Azure CLI to install it by running the command, `az aks install-cli`. |
| 21 | +- **Client URL (`cURL`) tool**: Install it by following [this guidance](https://www.tecmint.com/install-curl-in-linux/). |
| 22 | + |
| 23 | +## Common symptoms |
| 24 | + |
| 25 | +> [!NOTE] |
| 26 | +> This article focuses on Application Gateway Ingress Controller issues. Other underlying problems might cause similar symptoms. For more information, see [Troubleshoot connection issues to an app hosted in an AKS cluster](/troubleshoot/azure/azure-kubernetes/connectivity/connection-issues-application-hosted-aks-cluster). |
| 27 | +
|
| 28 | +| Symptom | Description | |
| 29 | +| --- | --- | |
| 30 | +| **Ingress without IP address** | Errors in assigning an `IP address` to the `Ingress` indicate that AGIC isn't functioning correctly. | |
| 31 | +| **HTTP Timeout** | If `DNS`, `Ingress`, and `Application` are working, AGIC is the likely cause of the issue. | |
| 32 | + |
| 33 | +## Step 1: Verify application functionality |
| 34 | + |
| 35 | +Make sure that your application is functioning correctly before you troubleshoot AGIC. Follow these steps: |
| 36 | + |
| 37 | +1. **Describe your service**: |
| 38 | + |
| 39 | + ```console |
| 40 | + kubectl describe service <YOUR_SERVICE> -n <YOUR_NAMESPACE> |
| 41 | + ``` |
| 42 | + |
| 43 | +2. **Copy the port details**: |
| 44 | + |
| 45 | + ```console |
| 46 | + $ kubectl describe service <YOUR_SERVICE> -n <YOUR_NAMESPACE> |
| 47 | + Name: dummy-web |
| 48 | + Namespace: default |
| 49 | + Labels: app=dummy-web |
| 50 | + Annotations: <none> |
| 51 | + Selector: app=dummy-web |
| 52 | + Type: ClusterIP |
| 53 | + IP Family Policy: SingleStack |
| 54 | + IP Families: IPv4 |
| 55 | + IP: 10.0.29.113 |
| 56 | + IPs: 10.0.29.113 |
| 57 | + Port: <unset> 8080/TCP |
| 58 | + TargetPort: 8080/TCP |
| 59 | + Endpoints: 10.224.0.49:8080,10.224.0.47:8080,10.224.0.4:8080 + 12 more... |
| 60 | + Session Affinity: None |
| 61 | + Internal Traffic Policy: Cluster |
| 62 | + Events: |
| 63 | + Type Reason Age From Message |
| 64 | + ---- ------ ---- ---- ------- |
| 65 | + ``` |
| 66 | + |
| 67 | +3. **Port-forward your service**: |
| 68 | + |
| 69 | + ```console |
| 70 | + kubectl port-forward svc/<YOUR_SERVICE> 9090:<YOUR_SERVICE_PORT> -n <YOUR_NAMESPACE> |
| 71 | + ``` |
| 72 | + |
| 73 | +4. **Test the application locally**: |
| 74 | + |
| 75 | + ```console |
| 76 | + curl -v http://localhost:9090 |
| 77 | + ``` |
| 78 | + |
| 79 | +5. **Verify application functionality**: |
| 80 | + |
| 81 | + > [!NOTE] |
| 82 | + > Investigate and resolve any errors that you encountered during this step before you proceed. |
| 83 | + |
| 84 | + ```console |
| 85 | + $ curl -v http://localhost:9090 |
| 86 | + * Host localhost:9090 was resolved. |
| 87 | + * IPv6: ::1 |
| 88 | + * IPv4: 127.0.0.1 |
| 89 | + * Trying [::1]:9090... |
| 90 | + * Connected to localhost (::1) port 9090 |
| 91 | + > GET / HTTP/1.1 |
| 92 | + > Host: localhost:9090 |
| 93 | + > User-Agent: curl/8.5.0 |
| 94 | + > Accept: */* |
| 95 | + > |
| 96 | + < HTTP/1.1 200 OK |
| 97 | + < Content-Type: text/html; charset=utf-8 |
| 98 | + < Date: Tue, 27 May 2025 00:54:58 GMT |
| 99 | + < Server: Kestrel |
| 100 | + < Transfer-Encoding: chunked |
| 101 | + ``` |
| 102 | + |
| 103 | +## Step 2: Inspect Ingress settings |
| 104 | + |
| 105 | +Verify that the `Ingress` was created correctly: |
| 106 | + |
| 107 | +1. **Describe the specific Ingress**: |
| 108 | + |
| 109 | + ```console |
| 110 | + kubectl describe ingress <YOUR_INGRESS> -n <YOUR_NAMESPACE> |
| 111 | + ``` |
| 112 | + |
| 113 | +2. **Check events, rules, and address**: |
| 114 | + |
| 115 | + ```console |
| 116 | + $ kubectl describe ingress <YOUR_INGRESS> -n <YOUR_NAMESPACE> |
| 117 | + Name: dummy-web |
| 118 | + Labels: <none> |
| 119 | + Namespace: default |
| 120 | + Address: |
| 121 | + Ingress Class: azure-application-gateway |
| 122 | + Default backend: <default> |
| 123 | + Rules: |
| 124 | + Host Path Backends |
| 125 | + ---- ---- -------- |
| 126 | + * |
| 127 | + / dummy-web:8080 (10.224.0.70:8080,10.224.0.72:8080,10.224.0.88:8080 + 12 more...) |
| 128 | + Annotations: <none> |
| 129 | + Events: |
| 130 | + Type Reason Age From Message |
| 131 | + ---- ------ ---- ---- ------- |
| 132 | + Normal ResetIngressStatus 13m (x5 over 13m) azure/application-gateway Reset IP for Ingress default/dummy-web. Application Gateway <APPLICATION_GATEWAY_ID> is in stopped state |
| 133 | + ``` |
| 134 | + |
| 135 | +If the `Ingress` lacks an address or displays events that indicate issues, investigate further. |
| 136 | + |
| 137 | +## Step 3: Inspect Ingress pod logs |
| 138 | + |
| 139 | +1. **Find the Ingress pod**: |
| 140 | + |
| 141 | + ```console |
| 142 | + kubectl get pod -A | grep ingress |
| 143 | + ``` |
| 144 | + |
| 145 | +2. **Inspect the logs**: |
| 146 | + |
| 147 | + ```console |
| 148 | + kubectl logs <INGRESS_POD_NAME> -n <YOUR_NAMESPACE> |
| 149 | + ``` |
| 150 | + For the AGIC that is deployed by using the add-on, run the following command: |
| 151 | + |
| 152 | + ```console |
| 153 | + kubectl logs -n kube-system -l=app=ingress-appgw |
| 154 | + ``` |
| 155 | + |
| 156 | +Look for any errors or warnings that might indicate what's going wrong. |
| 157 | + |
| 158 | +## Step 4: Check Application Gateway operational State |
| 159 | + |
| 160 | +It focuses on understanding the operational state of the [Application Gateway](/azure/application-gateway/overview) if it's used as an [Ingress Controller on AKS](/azure/application-gateway/ingress-controller-overview). |
| 161 | + |
| 162 | +### [Add-on](#tab/Add-on) |
| 163 | + |
| 164 | +1. Get the Application Gateway name: |
| 165 | + |
| 166 | + ```console |
| 167 | + az aks show --name <YOUR_AKS_NAME> --resource-group <YOUR_RG_NAME> --query addonProfiles.ingressApplicationGateway |
| 168 | + ``` |
| 169 | + |
| 170 | + > [!NOTE] |
| 171 | + > If you encounter an unexpected error during this step, AGIC might be misconfigured. In this case, refer to the following guide: [Enable the ingress controller add-on for a new AKS cluster with a new application gateway instance](/azure/application-gateway/tutorial-ingress-controller-add-on-new). |
| 172 | + |
| 173 | + ```console |
| 174 | + { |
| 175 | + "config": { |
| 176 | + "applicationGatewayName": "<YOUR_APPLICATION_GATEWAY_NAME>", |
| 177 | + "effectiveApplicationGatewayId": "...", |
| 178 | + "subnetCIDR": "..." |
| 179 | + }, |
| 180 | + "enabled": true, |
| 181 | + .. |
| 182 | + } |
| 183 | + ``` |
| 184 | + |
| 185 | +2. Verify the Application Gateway operational state: |
| 186 | + |
| 187 | + ```console |
| 188 | + az network application-gateway show --name <YOUR_APPLICATION_GATEWAY_NAME> --resource-group <YOUR_RG_NAME> --query operationalState |
| 189 | + ``` |
| 190 | + |
| 191 | + |
| 192 | +### [Helm](#tab/helm) |
| 193 | + |
| 194 | +1. Get the Application Gateway name: |
| 195 | + |
| 196 | + ```console |
| 197 | + helm show values agic-controller --jsonpath "appgw.name" |
| 198 | + ``` |
| 199 | + |
| 200 | + > [!NOTE] |
| 201 | + > If you see any unexpected error on this step, you might have misconfigured `AGIC`, see [Install AGIC by using a new Application Gateway deployment](/azure/application-gateway/ingress-controller-install-new). |
| 202 | + |
| 203 | +2. Validate the Application Gateway operational state: |
| 204 | + |
| 205 | + ```console |
| 206 | + az network application-gateway show --name <YOUR_APPLICATION_GATEWAY_NAME> --resource-group <YOUR_RG_NAME> --query operationalState |
| 207 | + ``` |
| 208 | + |
| 209 | +The expected `operationalState` value is `Running`. If it's something different, you might have to restart the Application Gateway. |
| 210 | + |
| 211 | +--- |
| 212 | +## Step 5 (Optional): Inspect Mapped Kubernetes and Application Gateway IPs |
| 213 | + |
| 214 | +The [AGIC](/azure/application-gateway/ingress-controller-overview) monitors the pod IPs and maps them to `backendAddressPools` in the `Application Gateway` instance. This step verifies that integration. |
| 215 | + |
| 216 | +1. **Get the Application Gateway `backendAddressPools`**: |
| 217 | + |
| 218 | + ```console |
| 219 | + az network application-gateway show --name <YOUR_APPLICATION_GATEWAY_NAME> --resource-group <YOUR_RG_NAME> --query backendAddressPools |
| 220 | + ``` |
| 221 | + |
| 222 | +2. **Get the pod IPs by using Kubernetes endpoints**: |
| 223 | + |
| 224 | + ```console |
| 225 | + kubectl describe endpoints <YOUR_SERVICE_NAME> -n <YOUR_NAMESPACE> | grep Addresses |
| 226 | + ``` |
| 227 | + |
| 228 | +3. **Compare the results**: |
| 229 | + |
| 230 | + Make sure that the lists from steps 1 and 2 are equivalent. If they're not, AGIC might not be working correctly. |
| 231 | + |
| 232 | +## Solution: Start the Application Gateway |
| 233 | + |
| 234 | +If AGIC isn't working as expected, it might be stopped or misconfigured. If the Application Gateway operational state isn't `Running`, start or restart AGIC, wait a few seconds, and then test the application again. |
| 235 | + |
| 236 | +```console |
| 237 | +az network application-gateway start --name <YOUR_APPLICATION_GATEWAY_NAME> --resource-group <YOUR_RG_NAME> |
| 238 | +``` |
| 239 | + |
| 240 | +## Additional resources |
| 241 | + |
| 242 | +- [Learn more about Azure Kubernetes Service (AKS) best practices](/azure/aks/best-practices) |
| 243 | +- [Monitor your Kubernetes cluster performance with Container insights](/azure/azure-monitor/containers/container-insights-analyze) |
| 244 | + |
| 245 | +[!INCLUDE [Third-party information disclaimer](../../../includes/third-party-disclaimer.md)] |
| 246 | + |
| 247 | +[!INCLUDE [Third-party contact information disclaimer](../../../includes/third-party-contact-disclaimer.md)] |
| 248 | + |
| 249 | +[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)] |
0 commit comments