<p>I'm trying to access a simple Asp.net core application deployed on Azure AKS but I'm doing something wrong.</p>
<p>This is the deployment .yml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: aspnetapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: aspnet
  template:
    metadata:
      labels:
        app: aspnet
    spec:
      containers:
      - name: aspnetapp
        image: &lt;my_image&gt;
        resources:
            limits:
              cpu: &quot;0.5&quot;
              memory: 64Mi
        ports:
        - containerPort: 8080
</code></pre>
<p>and this is the service .yml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: aspnet-loadbalancer
spec:
  type: LoadBalancer
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080
  selector:
    name: aspnetapp
</code></pre>
<p>Everything seems deployed correctly</p>
<p><a href="https://i.stack.imgur.com/fxeIr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fxeIr.png" alt="enter image description here" /></a></p>
<p>Another check I did was to enter the pod and run
<code>curl http://localhost:80</code>,
and the application is running correctly, but if I try to access the application from the browser using <a href="http://20.103.147.69" rel="nofollow noreferrer">http://20.103.147.69</a> a timeout is returned.</p>
<p>What else could be wrong?</p>

Salvatore Calla'
<p>Seems that you do not have an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/" rel="nofollow noreferrer">Ingress Controller</a> deployed on your AKS as you have your application exposed directly. You will need that in order to get <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">ingress</a> to work.</p>
<p>To verify if your application is working your can use port-forward and then access http://localhost:8080 :</p>
<pre><code>kubectl port-forward aspnetapp 8080:8080
</code></pre>
<p>But you should def. install a ingress-controller: Here is a Workflow from MS to install <a href="https://learn.microsoft.com/en-us/azure/aks/ingress-basic?tabs=azure-cli" rel="nofollow noreferrer">ingress-nginx</a> as IC on your Cluster.</p>
<p>You will then only expose the ingress-controller to the internet and could also specify the loadBalancerIP statically if you created the PublicIP in advance:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-resource-group: myResourceGroup # only needed if the LB is in another RG
  name: ingress-nginx-controller
spec:
  loadBalancerIP: &lt;YOUR_STATIC_IP&gt;
  type: LoadBalancer
</code></pre>
<p>The Ingress Controller then will route incoming traffic to your application with an Ingress resource:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
spec:
  ingressClassName: nginx # ingress-nginx specifix
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: test
            port:
              number: 80
</code></pre>
<p>PS: Never expose your application directly to the internet, always use the ingress controller</p>
