title: Unable to access Spring Boot microservice exposed via nginx ingress controller on Kubernetes cluster running on AWS
body: <p>I have spun up a 3 node Kubernetes cluster (version: 1.5.8) on AWS using the kube-up.sh script following this walkthrough:</p>
  
  <p><a href="https://ryaneschinger.com/blog/building-a-kubernetes-cluster-on-aws/" rel="nofollow noreferrer">https://ryaneschinger.com/blog/building-a-kubernetes-cluster-on-aws/</a></p>
  
  <p>I'm able to successfully access the cluster and view the UI. Output of <code>kubectl cluster-info</code> command:</p>
  
  <p><a href="https://i.stack.imgur.com/sJYhc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sJYhc.png" alt="enter image description here"></a></p>
  
  <p>I wrote a simple Spring Boot microservice:</p>
  
  <pre><code>@RestController
  public class AddCustomerController {
  
      private static final String template = "Customer %s is added.";
  
      @RequestMapping("/addcustomer")
      public Message addcustomer(@RequestParam(value="name") String name) {
  
          //Retrieve the hostname of the "node"/"container"
          String hostname = null;
          try {
              hostname = InetAddress.getLocalHost().getHostName();
          } catch (UnknownHostException e) {
              e.printStackTrace();
          }
  
          return new Message(ThreadLocalRandom.current().nextLong(),
                              String.format(template, name),
                              hostname);
      }
  }
  </code></pre>
  
  <p>and packaged it in a Docker container after the Gradle build and am able to successfully use it locally. I have pushed the image to DockerHub.</p>
  
  <pre><code>FROM openjdk:8-jdk-alpine
  VOLUME /tmp
  ADD build/libs/*.jar app.jar
  ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
  </code></pre>
  
  <p>Now I'm using Helm Charts to deploy this application to Kubernetes.</p>
  
  <p>Deployment descriptor:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: add-customer-deployment
  spec:
    replicas: 3
    template:
      metadata:
        name: add-customer-microservice
        labels:
          app: add-customer
      spec:
        containers:
        - image: {{ .Values.dockerHubUsername }}/add-customer-microservice:latest
          name: add-customer-microservice
          imagePullPolicy: Always
          ports:
          - containerPort: 8080
  </code></pre>
  
  <p>Service descriptor:</p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: add-customer-service
  spec:
    selector:
      app: add-customer
    ports:
      - port: 1000
        protocol: TCP
        targetPort: 8080
        name: access-port
    type: NodePort
  </code></pre>
  
  <p>I have followed the same procedure for 3 other similar Spring Boot microservices.</p>
  
  <p>Ingress descriptor:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: quantiphi-poc-ingress-dns
    annotations:
      kubernetes.io/ingress.class: nginx
  spec:
    rules:
      - host: crud.qdatalabs.com
        http:
          paths:
          - path: /service1
            backend:
              serviceName: add-customer-service
              servicePort: 1000
          - path: /service1/*
            backend:
              serviceName: add-customer-service
              servicePort: 1000
          - path: /service2
            backend: 
              serviceName: get-customer-service
              servicePort: 2000
          - path: /service2/*
            backend:
              serviceName: get-customer-service
              servicePort: 2000
          - path: /service3
            backend: 
              serviceName: update-customer-service
              servicePort: 3000
          - path: /service3/*
            backend:
              serviceName: update-customer-service
              servicePort: 3000
          - path: /service4
            backend: 
              serviceName: delete-customer-service
              servicePort: 4000
          - path: /service4/*
            backend:
              serviceName: delete-customer-service
              servicePort: 4000
  </code></pre>
  
  <p>First I install the nginx controller on my cluster using the Helm Charts:</p>
  
  <pre><code>helm install --name my-release stable/nginx-ingress
  </code></pre>
  
  <p>Then I install my Chart using:</p>
  
  <pre><code>helm install folder-conataining-helm-chart/
  </code></pre>
  
  <p>Then I point the alias of crud.qdatalabs.com (Type A) from Route53 to the ELB spawned by the Ingress resource.</p>
  
  <p>The URL <a href="http://crud.qdatalabs.com/healthz" rel="nofollow noreferrer">crud.qdatalabs.com/healthz</a>
  is giving 200 OK response</p>
  
  <p>When I try to access the microservices using the URL <a href="http://crud.qdatalabs.com/service1/addcustomer?name=starman" rel="nofollow noreferrer">crud.qdatalabs.com/service1/addcustomer?name=starman</a></p>
  
  <p>I'm treated with the WhiteLabel Error Page:</p>
  
  <p><a href="https://i.stack.imgur.com/pu9Oc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pu9Oc.png" alt="enter image description here"></a></p>
  
  <p>I think I have made some configuration error, but can't put my finger on it. Please help me with any direction. I'll be happy to provide more details. Thank you.</p>