How can I expose the LoadBalancer Service IP instead of the Pod IP in the Azure Application Gateway backend pool target?

Venkatesh D 0 Reputation points
2025-03-14T08:35:57.41+00:00

AGIC is creating backend pools in the Application Gateway with the Pod IPs as targets. How can we configure it to expose the LoadBalancer service IP instead of the Pod IP?

below is the YML:

apiVersion: networking.k8s.io/v1

kind: Ingress

metadata:

name: dev-ingress

namespace: default

annotations:

appgw.ingress.kubernetes.io/ssl-redirect: "true"

appgw.ingress.kubernetes.io/use-private-ip: "true"

#kubernetes.io/ingress.class: azure/application-gateway

nginx.ingress.kubernetes.io/rewrite-target: "/"

spec:

ingressClassName: azure-application-gateway

tls:

- secretName: agic-tls-secret

rules:

- host: dev.ba.apim.com

  http:

    paths:

      - path: /

        pathType: Prefix

        backend:

          service:

            name: sv-default-service

            port:

              number: 80

     
Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
774 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-03-21T14:31:18.84+00:00

    Hi Venkatesh D,

    Thanks for the update! Since your service is of type LoadBalancer with an assigned external IP and AGIC is still targeting Pod IPs, please check the following:

    Confirm use-external-service Annotation Uncomment and apply the following annotation in your Ingress resource to explicitly instruct AGIC to use the external service IP:

     appgw.ingress.kubernetes.io/use-external-service: "true"
    

    Verify AGIC’s Backend Address Type Uncomment and set:

    yaml

    appgw.ingress.kubernetes.io/backend-address-type:"External"

    This ensures AGIC targets the LoadBalancer service IP instead of Pod IPs.

    Restart AGIC to Apply Changes

    kubectl rollout restart deployment ingress-azure -n kube-system

    After applying these changes, check the AGIC logs again to verify if the LoadBalancer IP is being used.

    If it was helpful, please click "Upvote" on this post to let us know.

    Thank You.

    0 comments No comments

Your answer

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