Ingress works with sample python apps, but not ASP.NET MVC Core 3 Hello World RRS feed

  • Question

  • User-2098916251 posted

    I'm following these instructions https://docs.microsoft.com/en-us/azure/aks/ingress-basic using Docker for Desktop/Kubernetes on Windows 10.

    This tutorial works great for the sample python webapps described in that tutorial. However, when I use Visual Studio 2019 (v 16.6.5) to create a "Hello World" style web app with ASP.NET/MVC Core 3 ingress won't display it after it is deployed. (However, this webApp works fine with the F5 key in Visual Studio).

    I have copied the file aks-helloworld-one.yaml to kuberneteshelloaspnet.yaml and modified it accordingly for my new WebApp.

    This newly created WebApp is just the code generated by the the Visual Studio code generator that displays "Hello Kubernetes" and the current date & time.  I add this line of code to program.cs:

    webBuilder.ConfigureKestrel(serverOptions => { serverOptions.Listen(System.Net.IPAddress.Loopback, 80); });

    I compile this in release mode, test it (it works great) and publish to github and dockerhub.

    I add an entry to hello-world-ingress.yaml for my new WebApp.

    - backend:
    serviceName: kuberneteshelloaspnet
    servicePort: 80

    I use the following commands:

    kubectl create namespace ingress-basic # microsoft ingress example
    helm repo add stable https://kubernetes-charts.storage.googleapis.com/
    helm install nginx-ingress stable/nginx-ingress \
    --namespace ingress-basic \
    --set controller.replicaCount=2 \
    --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
    --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux
    kubectl get service -l app=nginx-ingress --namespace ingress-basic
    kubectl apply -f ${WINOOP_EG}/kubernetes/ingress-basic/aks-helloworld-one.yaml --namespace ingress-basic
    kubectl apply -f ${WINOOP_EG}/kubernetes/ingress-basic/aks-helloworld-two.yaml --namespace ingress-basic
    kubectl apply -f ${WINOOP_EG}/kubernetes/ingress-basic/kuberneteshelloaspnet.yaml --namespace ingress-basic
    kubectl apply -f ${WINOOP_EG}/kubernetes/ingress-basic/hello-world-ingress.yaml

    I point my browser to localhost:helloworld-one and localhost:helloworld-two and they work! Great! However, when I point my browser to localhost:kuberneteshelloaspnet I get


    503 Service Temporarily Unavailable


    What am I doing wrong? Why won't my application work with Ingress?

    Mon Aug 24 2020 Update

    I just tried the following commands

        netstat -ano | grep 80

    Nothing is running on port 80.

        kubectl run kuberneteshelloaspnet --image=siegfried01/kuberneteshelloworldaspnet --replicas=1 --port=80 --labels="app=todo,tier=test"

        kubectl expose deployment kuberneteshelloaspnet

        kubectl edit service todolistclient

    I change the type to LoadBalancer

    I point my browser to localhost:80 and edge says:

    This page isn’t working right now

    localhost didn’t send any data.

    When I do the same exercise with aks-helloworld-one (the sample python webapp that comes with the tutorial) and expose the service as a loadbalancer, I can see it run at localhost:80.

    What am I doing wrong with my ASP.NET Core MVC WebApp?



    Saturday, August 22, 2020 1:47 AM


  • User261999082 posted

    Can you try changing 

    webBuilder.ConfigureKestrel(serverOptions => { serverOptions.Listen(System.Net.IPAddress.Loopback, 80); });


    webBuilder.ConfigureKestrel(serverOptions => { serverOptions.Listen(System.Net.IPAddress.Any, 80); });

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 24, 2020 9:04 PM