<p>I have created a kubernetes project in visual studio 2019, with the default template. This template creates a WeatherForecast controller.
After that I have published it to my ARC.</p>
<p>I used this command to create the AKS:</p>
<pre><code>az aks create -n $MYAKS -g $MYRG --generate-ssh-keys --z 1 -s Standard_B2s --attach-acr /subscriptions/mysubscriptionguid/resourcegroups/$MYRG/providers/Microsoft.ContainerRegistry/registries/$MYACR
</code></pre>
<p>And I enabled HTTP application routing via the azure portal.</p>
<p>I have deployed it to azure kubernetes (Standard_B2s), with the following deployment.yaml:</p>
<pre><code># deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kubernetes1-deployment
  labels:
    app: kubernetes1-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: kubernetes1
  template:
    metadata:
      labels:
        app: kubernetes1
    spec:
      containers:
      - name: kubernetes1
        image: mycontainername.azurecr.io/kubernetes1:latest
        ports:
        - containerPort: 80
</code></pre>
<p>service.yaml:</p>
<pre><code>#service.yaml
apiVersion: v1
kind: Service
metadata:
  name: kubernetes1
spec:
  type: ClusterIP
  selector:
    app: kubernetes1
  ports:
    - port: 80 # SERVICE exposed port
      name: http # SERVICE port name
      protocol: TCP # The protocol the SERVICE will listen to
      targetPort: http # Port to forward to in the POD
</code></pre>
<p>ingress.yaml:</p>
<pre><code>#ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kubernetes1
  annotations:
    kubernetes.io/ingress.class: addon-http-application-routing
spec:
  rules:
    - host: kubernetes1.&lt;uuid (removed for this post)&gt;.westeurope.aksapp.io # Which host is allowed to enter the cluster
      http:
        paths:
          - backend: # How the ingress will handle the requests
              service:
               name: kubernetes1 # Which service the request will be forwarded to
               port:
                 name: http # Which port in that service
            path: / # Which path is this rule referring to
            pathType: Prefix # See more at https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
</code></pre>
<p>But when I go to kubernetes1..westeurope.aksapp.io or kubernetes1..westeurope.aksapp.io/WeatherForecast I get the following error:</p>
<blockquote>
<pre><code>503 Service Temporarily Unavailable
nginx/1.15.3
</code></pre>
</blockquote>

1408786user
<p>It's working now. For other people who have the same problem. I have updated my deployment config from:</p>
<pre><code># deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kubernetes1-deployment
  labels:
    app: kubernetes1-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: kubernetes1
  template:
    metadata:
      labels:
        app: kubernetes1
    spec:
      containers:
      - name: kubernetes1
        image: mycontainername.azurecr.io/kubernetes1:latest
        ports:
        - containerPort: 80
</code></pre>
<p>to:</p>
<pre><code># deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kubernetes1
spec:
  selector: # Define the wrapping strategy
    matchLabels: # Match all pods with the defined labels
      app: kubernetes1 # Labels follow the `name: value` template
  template: # This is the template of the pod inside the deployment
    metadata:
      labels:
        app: kubernetes1
    spec:
      nodeSelector:
        kubernetes.io/os: linux
      containers:
        - image: mycontainername.azurecr.io/kubernetes1:latest
          name: kubernetes1
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 250m
              memory: 256Mi
          ports:
            - containerPort: 80
              name: http
</code></pre>
<p>I don't know exactly which line solved the problem. Feel free to comment it if you know which line the problem was.</p>
