Share via

My application gateway is not exposing the service endpoints hosted on my private AKS cluster

cargobuddy 20 Reputation points
2026-03-17T09:35:51.6633333+00:00

Perhaps I am missing something in the listener and backend configuration, but not sure. I am not able to configure the endpoints, and the backend always results into 502 error.

Azure Kubernetes Service
Azure Kubernetes Service

An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.


2 answers

Sort by: Most helpful
  1. Nikhil Duserla 9,685 Reputation points Microsoft External Staff Moderator
    2026-04-05T18:23:56.31+00:00

    Hello @cargobuddy ,

    Apologies for the delayed response.

    The path is reverting to the default routing because the Application Gateway Ingress Controller (AGIC) continuously enforces the configuration defined in the Kubernetes Ingress resources.

    When application changes are deployed through the Azure DevOps pipeline, the pipeline reapplies or updates the Kubernetes Ingress configuration. AGIC then reconciles the Application Gateway to ensure it exactly matches the state defined in the Ingress manifest.

    If the updated deployment:

    • Does not include the same path-based routing rules, or
    • Recreates or modifies the Ingress resource,

    AGIC removes the existing path rules and falls back to the default backend configuration. As a result, traffic may be routed incorrectly, leading to HTTP 502 errors.

    This behavior is expected and is by design when using AGIC.

    This happens specifically during pipeline deployments:

    1. AGIC treats Kubernetes as the single source of truth.
    2. Any manual changes made directly on the Application Gateway are overwritten.
    3. Each pipeline run reapplies and enforces the Ingress YAML configuration.
    4. Missing or modified path-based rules during deployment cause AGIC to reset routing to the default configuration.

    To prevent this from occurring:

    • Ensure all required path-based routing rules are explicitly defined in the Kubernetes Ingress YAML.
    • Maintain a consistent Ingress resource name across deployments.
    • Avoid making manual changes directly to the Application Gateway.
    • Verify that health probe paths align with the application endpoints.

    If these conditions are met, routing will remain stable across deployments.

    Traffic routing continues to work during application changes as long as the Kubernetes Ingress always defines the full path‑based routing configuration. Any routing reset happens because routing rules were not included in the deployment, not because deployments themselves are unsupported.

    1. Always deploy a complete Ingress definition
    2. Keep the Ingress name unchanged

    AGIC does not retain or preserve previously configured routing rules. Instead, it reconstructs the routing configuration strictly based on the current Kubernetes Ingress YAML.

    • If all required paths are defined in the Ingress YAML, routing functions as expected.
    • If any paths are missing, AGIC defaults to the fallback backend configuration, which can result in HTTP 502 errors.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.

    0 comments No comments

  2. Sina Salam 28,361 Reputation points Volunteer Moderator
    2026-03-30T01:23:35.3333333+00:00

    Hello cargobuddy,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that your application gateway is not exposing the service endpoints hosted on my private AKS cluster.

    The issue is not that Application Gateway “fails to expose endpoints”, but that it cannot reach or validate your AKS backend, usually because of failed health probes or network connectivity, resulting in HTTP 502 errors.

    Follow the below steps to resolve it:

    1. Verify your workload returns 200 OK within the cluster using: kubectl port-forward svc/<service> 8080:<port> curl `http://localhost:8080` If the app fails internally, fix it first – https://learn.microsoft.com/azure/aks/troubleshooting.
    2. Check that the service exposes the expected pod IPs and ports: kubectl describe svc <service> kubectl describe endpoints <service> You must see healthy endpoints mapped to pods.
    3. If your application does not respond on /, configure the correct probe path: annotations:   appgw.ingress.kubernetes.io/health-probe-path: "/health" Any exposed path must return HTTP 200, as required by App Gateway health probes -https://learn.microsoft.com/azure/application-gateway/application-gateway-probe-overview.
    4. Ensure the Ingress is correctly bound to Application Gateway: annotations:   kubernetes.io/ingress.class: azure/application-gateway Also confirm that your service ports match the backend container target ports.
    5. Review AGIC logs for configuration sync or backend pool errors: kubectl logs -n kube-system -l app=ingress-appgw The controller should continuously update listeners, rules, and backend pools -https://learn.microsoft.com/azure/application-gateway/ingress-controller-overview.
    6. Check the backend addresses from Application Gateway: az network application-gateway show </span> --name <appgw> </span> --resource-group <rg> </span> --query backendAddressPools Compare with: kubectl get Both must contain the same pod IPs, as documented in Azure Backend Pool requirements.
    7. Ensure the App Gateway subnet can reach pod CIDR and node subnet by checking NSGs, UDRs, and bidirectional VNet peering - https://learn.microsoft.com/azure/aks/upgrade-cluster#validate-networking.
    8. Verify that the gateway itself is healthy: az network application-gateway show </span>   --name <appgw> </span>   --resource-group <rg> </span>   --query operationalState It must show Running before traffic can be routed correctly.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.