title: Kubernetes ingress returning 404
body: <p>I have Kubernetes running in Docker for Windows.</p>
  
  <p>I am using NGINX ingress controller, I have applied the <code>mandatory.yaml</code> and the <code>cloud-generic.yaml</code>.</p>
  
  <pre><code>&gt; kubectl get services -n ingress-nginx
  NAME            TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
  ingress-nginx   LoadBalancer   10.110.198.161   localhost     80:30037/TCP,443:31218/TCP   5h
  </code></pre>
  
  <p>I have an image in my local registry <code>test-app/mock-service:1.0.0</code> which exposes port 8080 running a server with a single endpoint <code>GET /mocks</code>. Running this in Docker using <code>docker run -d -p 8080:8080 test-app/mock-service:1.0.0</code> works and I can see the expected result.</p>
  
  <p>My intention is to deploy this using Kubernetes.</p>
  
  <p>I created a deployment and service resource:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: test-app-mock-service-deployment
    namespace: test-app
  spec:
    selector:
      matchLabels:
        app: test-app-mock-service
    replicas: 1
    template:
      metadata:
        labels:
          app: test-app-mock-service
      spec:
        containers:
        - name: test-app-mock-service-container
          image: "test-app/mock-service:1.0.0"
  ---
  apiVersion: v1
  kind: Service
  metadata:
    name: test-app-mock-service
    namespace: test-app
  spec:
    type: ClusterIP
    selector:
      app: test-app-mock-service
    ports:
    - port: 8080
      targetPort: 8080
      protocol: TCP
  </code></pre>
  
  <p>And an ingress resource:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: test-app-ingress
    namespace: test-app
    annotations:
      ingress.kubernetes.io/ssl-redirect: "true"
  spec:
    rules:
    - http:
        paths:
        - path: /mocks
          backend:
            serviceName: test-app-mock-service
            servicePort: 8080
  </code></pre>
  
  <p>I can see the service:</p>
  
  <pre><code>&gt; kubectl get services -n test-app
  NAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
  test-app-mock-service   ClusterIP   10.108.10.246   &lt;none&gt;        8080/TCP   1h
  </code></pre>
  
  <p>And the pod:</p>
  
  <pre><code>&gt; kubectl get pods -n test-app
  NAME                                                READY     STATUS    RESTARTS   AGE
  test-app-mock-service-deployment-6b9b58fcb9-mdskn   1/1       Running   0          59m
  </code></pre>
  
  <p>I can see the ingress:</p>
  
  <pre><code>&gt; kubectl describe ingress test-app-ingress -n test-app
  Name:             test-app-ingress
  Namespace:        test-app
  Address:          localhost
  Default backend:  default-http-backend:80 (&lt;none&gt;)
  Rules:
    Host  Path  Backends
    ----  ----  --------
    *
          /mocks  test-app-mock-service:8080 (&lt;none&gt;)
  Annotations:
    ingress.kubernetes.io/ssl-redirect:                true
    kubectl.kubernetes.io/last-applied-configuration:  {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"ingress.kubernetes.io/ssl-redirect":"true"},"name":"test-app-ingress","namespace":"test-app"},"spec":{"rules":[{"http":{"paths":[{"backend":{"serviceName":"test-app-mock-service","servicePort":8080},"path":"/mocks"}]}}]}}
  
  Events:
    Type    Reason  Age               From                      Message
    ----    ------  ----              ----                      -------
    Normal  CREATE  1h                nginx-ingress-controller  Ingress test-app/test-app-ingress
    Normal  UPDATE  53m (x2 over 1h)  nginx-ingress-controller  Ingress test-app/test-app-ingress
  </code></pre>
  
  <p>However when I browse to <code>http://localhost/mocks</code> i get a 308 to  <code>https://localhost/mocks</code> where I get a 404.</p>
  
  <p>I'm not sure if the ingress is incorrectly configured or if it is another problem.</p>