Walmikk
Walmikk

Reputation: 45

Application Gateway is not able to route backend traffic to host provided in ingress file with AKS internal load balancer

I am facing an issue with App Gateway + Internal Load Balancer where path based routing is works perfectly but hostname base routing is not working which is define in ingress. Both the resources are in the same virtual network.

I have configured the public IP of the Application Gateway in the DNS Zone and routed all the traffic to the App Gateway listener.

Created App Gateway Listner with below host

host1 : cricket.mydomain.tech host2 : football.mydomain.tech

enter image description here

In AKS created nginx ingress controller and which automatically created internal load balancer and exposed below private IP, that IP i have confiuged in backend pool of listerner

enter image description here

In Ingress controller, did deployed below two ingress controller for Hello World application in AKS and generated hostname with certificates.

enter image description here enter image description here

So when I am opening the the hostname with cricket.mydomain.tech it opens the hello-world-one and works perfectly but when I am opening the football.mydomain.tech it is not opening

Screen shot when opening http://cricket.mydomain.tech or http://cricket.mydomain.tech/hello-world-one both path gives proper result

enter image description here

Screen shot when opening http://football.mydomain.tech/hello-world-two or http://football.mydomain.tech both path gives bellow msg enter image description here

Issue here is AKS Ingress controller is not routing traffic to second child domain with host name football.mydomain.tech or nginx is not picking up the proper domain which I am providing in hostname of listener. Can anyone please help here

I have followed below few article to configure this https://medium.com/@saifeddine.segni94/nginx-ingress-controllers-and-azure-app-gateway-for-azure-kubernetes-service-aks-f18c5be955d0

https://shuanglu1993.medium.com/application-gateway-work-with-aks-via-ssl-9894e7f4a587

Upvotes: 0

Views: 1419

Answers (1)

Imran
Imran

Reputation: 5570

This error usually occurs if the gateway is unable to connect to the backend server or that the backend server returned an invalid response.

According to> MsDoc if you have multiple domain contoso.com, Google.com, point to the IP address of the application gateway. You'd create two multi-site listeners and configure each listener for the respective port and protocol setting.

Create two listeners with hostname like below:

enter image description here

enter image description here

Create 1 http setting like below:

enter image description here

Create two routing rule and add listener for each make sure to add backend target http setting for both routing rule like below:

enter image description here

Additionally, in your virtual network add service endpoint microsoft.web with your application gateway subnet as like :

References:

Hosting multiple sites on Azure Application Gateway | Microsoft Learn

Troubleshoot Bad Gateway errors - Azure Application Gateway | Microsoft Learn

Upvotes: 0

Related Questions