502 Bad Gateway on windows nodes with AGIC
What happened: When deploying a container (Simple standard iis) using the new Application Gateway ingress everything seams alright but we are unable to navigate (http/https) to the container using AG.
What you expected to happen: Should be able to access the website hosted in k8s with Application Gateway.
How to reproduce it (as minimally and precisely as possible):
- Create a cluster with windows nodes.
- Setup Application gateway and ingress controller. (https://github.com/Azure/application-gateway-kubernetes-ingress)
- Deploy standard iis container with or without a https certificate -Try and navigate using the Application gateway as a loadbalancer.
Anything else we need to know?: Running the same container using our nginx loadbalancer works just fine with http/https. We tested with a linux container and that works fine with http/https and AG.
Backendpool
Pod in k8s:

As suggested by @MikkelHegn (https://github.com/Azure/AKS/issues/1367#issuecomment-577885316) we tested to remove default 10.0.0.0/8 from 10-azure.conflist but that had no result. (And yes we drained and rebooted)
Environment:
-
Aks cluster version: 1.15.7
-
Aks engine version: v.0.45.0-1-aks
-
Kubernetes version (use
kubectl version): Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.7", GitCommit:"6c143d35bb11d74970e7bc0b6c45b6bfdffc0bd4", GitTreeState:"clean", BuildDate:"2019-12-11T12:34:17Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"} -
Size of cluster (how many worker nodes are in the cluster?) 5
-
General description of workloads in the cluster (e.g. HTTP microservices, Java app, Ruby on Rails, machine learning, etc.) Http
-
Others:
Any update as for now?
@qmalexander what is the address space of the vnet (not subnet) for your cluster? We have a known issue when the address space of the vnet does not belong to 10.0.0.0/8. Please reference this issue: https://github.com/Azure/aks-engine/issues/2712
Hey @qmalexander, if @AbelHu's comment didn't help resolve your issue, I've got a few questions:
- Which version of AppGW are you using? (v1 vs. v2)
- Which version of AGIC are you using?
- When you go to the "Backend health" tab for the AppGW in Portal, what error does it show under the "details" column for the unhealthy backend? Feel free to include a screenshot of the AppGW Backend health table.
@mscatyao , sorry, I should add the reference to below two issues. I think that it should be the same issue. Azure/AKS#1367 Azure/application-gateway-kubernetes-ingress#535
@qmalexander what is the address space of the vnet (not subnet) for your cluster? We have a known issue when the address space of the vnet does not belong to 10.0.0.0/8. Please reference this issue: Azure/aks-engine#2712
Hi @AbelHu,
Sorry for the delay.
I can confirm that I have the vnet address space 10.0.0.0/8.

@qmalexander, so this is a new different environment and it is different issue from Azure/aks-engine#2712, right? If so, I think that you need to follow @mscatyao 's suggestion to provide more information.
Hey @qmalexander, if @AbelHu's comment didn't help resolve your issue, I've got a few questions:
- Which version of AppGW are you using? (v1 vs. v2)
- Which version of AGIC are you using? mcr.microsoft.com/azure-application-gateway/kubernetes-ingress:1.0.0
- When you go to the "Backend health" tab for the AppGW in Portal, what error does it show under the "details" column for the unhealthy backend? Feel free to include a screenshot of the AppGW Backend health table.


@qmalexander , I tried to reproduce your issue by following https://github.com/Azure/application-gateway-kubernetes-ingress/blob/master/docs/setup/install-new.md with adding a Windows agent pool in template.json but the appgateway works in my environment.
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
aspnetapp 1/1 Running 0 6m 10.0.0.14 aksnpwin000000 <none> <none>
deadly-clam-ingress-azure-855df98f68-2lqs9 1/1 Running 0 12m 10.0.0.55 aks-agentpool-35064155-vmss000000 <none> <none>
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
aspnetapp ClusterIP 10.2.141.213 <none> 80/TCP 8m34s

@AbelHu nice!
Can you give me some more details. Have you tested with https? Do you have the app and ingress controller on the different namespaces or are they on the same?
I will try it your way to see If I get the same result. I would realy like to get it working by adding it to our current clusters.
I followed this guides: https://github.com/Azure/application-gateway-kubernetes-ingress/blob/master/docs/setup/install-existing.md
https://docs.microsoft.com/bs-latn-ba/azure/aks/windows-container-cli
@AbelHu can you attach the azuredeploy template you used with the windows agent?
I only test http. You need to enable RBAC in all places and replace the windows password in template.json. win.yaml is the example I used to verify the deployment.
You must specify node-selectors when calling helm.
helm init --tiller-namespace kube-system --service-account tiller-sa --node-selectors "beta.kubernetes.io/os=linux"
helm install -f helm-config.yaml application-gateway-kubernetes-ingress/ingress-azure --set nodeSelector."beta\.kubernetes\.io/os"=linux
This has been fixed in #1466
