title: Springboot service deployed in AKS not working with ingress
body: <p>I have a simple Springboot service, which works well when I configure Service of type:LoadBalancer. But when I use service of type:ClusterIP and introduce ingress, it does not work</p>
  <p>For that matter, I am unable to get Ingress working for any of my deployments in Azure/AKS.</p>
  <p>Please suggest what am I missing</p>
  <p><strong>Spring code</strong></p>
  <pre><code>@RestController
  @RequestMapping(&quot;/demo&quot;)
  public class MyController {
      @GetMapping(&quot;/welcome&quot;)
      public String welcome() {
          return &quot;Hello Welcome&quot;;
      }
  }
  </code></pre>
  <p><strong>LoadBalancer - working code</strong>
  <strong>spring-microservice-deployment.yaml</strong></p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: spring-microservice
    namespace: default
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: spring-microservice
    template:
      metadata:
        labels:
          app: spring-microservice
      spec:
        containers:
          - name: spring-microservice
            image: babaacr.azurecr.io/welcome-service:1.0
            resources:
              requests:
                memory: '256Mi'
                cpu: '500m'
              limits:
                memory: '512Mi'
                cpu: '1'
            ports:
              - name: http
                containerPort: 8080
  </code></pre>
  <p><strong>spring-microservice-service.yaml</strong></p>
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: spring-microservice
    namespace: default
    labels:
      app: spring-microservice
  spec:
    selector:
      app: spring-microservice
    type: LoadBalancer
    ports:
      - name: http
        port: 8080
        targetPort: 8080
        protocol: TCP
  </code></pre>
  <p>when I access the url <a href="http://20.XXX.XX.XX:8080/demo/welcome" rel="nofollow noreferrer">http://20.XXX.XX.XX:8080/demo/welcome</a>
  message is printed</p>
  <p><strong>ingress based which is not working</strong></p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: spring-microservice-x
    namespace: default
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: spring-microservice-x
    template:
      metadata:
        labels:
          app: spring-microservice-x
      spec:
        containers:
          - name: spring-microservice-x
            image: babaacr.azurecr.io/welcome-service:1.0
            resources:
              requests:
                memory: '256Mi'
                cpu: '500m'
              limits:
                memory: '512Mi'
                cpu: '1'
            ports:
              - name: http
                containerPort: 8080
  </code></pre>
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: spring-microservice-x
    namespace: default
    labels:
      app: spring-microservice-x
  spec:
    selector:
      app: spring-microservice-x
    type: ClusterIP
    ports:
      - name: http
        port: 8080
        targetPort: 8080
        protocol: TCP
  </code></pre>
  <pre><code>apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: spring-microservice-ingress
  spec:
    defaultBackend:
      service:
        name: spring-microservice-x
        port: 
          number: 8080
  </code></pre>
  <p>when I access the url <a href="http://20.YYY.YY.YY:8080/demo/welcome" rel="nofollow noreferrer">http://20.YYY.YY.YY:8080/demo/welcome</a>
  the page times-out</p>
  <p>ingress controller is configured using below</p>
  <pre><code>helm install ingress-nginx ingress-nginx/ingress-nginx --set controller.service.annotations.&quot;service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path&quot;=/healthz
  </code></pre>