Azure / application-gateway-kubernetes-ingress

This is an ingress controller that can be run on Azure Kubernetes Service (AKS) to allow an Azure Application Gateway to act as the ingress for an AKS cluster.
https://azure.github.io/application-gateway-kubernetes-ingress
MIT License
671 stars 416 forks source link

Application gateway 502 Bad gateway #1196

Open balakrishna222111 opened 3 years ago

balakrishna222111 commented 3 years ago

502 Bad Gateway for application gateway

Backend pools unhealthy

image

502 Bad Gateway

image

I have aks cluster to that i enabled azure appication gateway .

To Reproduce Steps to reproduce the behavior:

Ingress Controller details

akshaysngupta commented 3 years ago

@balakrishna222111 I checked your cluster metadata and see that you are using kubenet network plugin with AKS. When using kubenet, you also need to assign AKS route table to AppGW subnet. This route table is required to setup connectivity b/w AppGW and AKS. Follow this document for steps on how to add the route table. https://github.com/Azure/application-gateway-kubernetes-ingress/blob/master/docs/how-tos/networking.md#with-kubenet

If this doesn't help, please feel free to create a support ticket.

balakrishna222111 commented 3 years ago

@akshaysngupta i tried below code but my aks and appgw are in 2 diff resource group so i couldn't able add route . Is there other solution ?

Executed belows command

` aksClusterName="" aksResourceGroup="" appGatewayName="" appGatewayResourceGroup=""

find route table used by aks cluster

nodeResourceGroup=$(az aks show -n $aksClusterName -g $aksResourceGroup -o tsv --query "nodeResourceGroup") routeTableId=$(az network route-table list -g $nodeResourceGroup --query "[].id | [0]" -o tsv)

get the application gateway's subnet

appGatewaySubnetId=$(az network application-gateway show -n $appGatewayName -g $appGatewayResourceGroup -o tsv --query "gatewayIpConfigurations[0].subnet.id")

associate the route table to Application Gateway's subnet

az network vnet subnet update \ --ids $appGatewaySubnetId --route-table $routeTableId `

Output

balakrishna222111 commented 3 years ago

@akshaysngupta is there any update ?

balakrishna222111 commented 3 years ago

@akshaysngupta I have one query

akshaysngupta commented 3 years ago

@akshaysngupta I have one query

Try using https://github.com/Azure/application-gateway-kubernetes-ingress/blob/master/docs/annotations.md#backend-path-prefix

akshaysngupta commented 3 years ago

@akshaysngupta i tried below code but my aks and appgw are in 2 diff resource group so i couldn't able add route . Is there other solution ?

Executed belows command

` aksClusterName="" aksResourceGroup="" appGatewayName="" appGatewayResourceGroup=""

find route table used by aks cluster

nodeResourceGroup=$(az aks show -n $aksClusterName -g $aksResourceGroup -o tsv --query "nodeResourceGroup") routeTableId=$(az network route-table list -g $nodeResourceGroup --query "[].id | [0]" -o tsv)

get the application gateway's subnet

appGatewaySubnetId=$(az network application-gateway show -n $appGatewayName -g $appGatewayResourceGroup -o tsv --query "gatewayIpConfigurations[0].subnet.id")

associate the route table to Application Gateway's subnet

az network vnet subnet update --ids $appGatewaySubnetId --route-table $routeTableId `

Output

You can also assign the route table using portal. Navigate to Application Gateway subnet and select the route table used by your AKS cluster.

henryzhan2020 commented 1 year ago

@akshaysngupta the query in the doc has some issue. need to remove the "0" from it.

get the application gateway's subnet

appGatewaySubnetId=$(az network application-gateway show -n $appGatewayName -g $appGatewayResourceGroup -o tsv --query "gatewayIpConfigurations[].subnet.id")

Ramkumartherk commented 5 months ago

Have you resolved this issue