title: TLS nginx ingress in AWS EKS Cluster results in 404 Not Found
body: <p>I am trying to use Kubernetes Ingress Nginx Controller and running a simple nginx server in AWS EKS.</p>
  <p>Browser (https) --&gt; Route 53 (DNS) --&gt; CLB --&gt; nginx Ingress (Terminate TLS) --&gt; Service --&gt; POD</p>
  <p>But I am receiving 404 error in browser (url used: <a href="https://example.com/my-nginx" rel="nofollow noreferrer">https://example.com/my-nginx</a>):</p>
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;title&gt;404 Not Found&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;center&gt;&lt;h1&gt;404 Not Found&lt;/h1&gt;&lt;/center&gt;
  &lt;hr&gt;&lt;center&gt;nginx/1.19.10&lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>and in ingress logs (kubectl logs -n nginx-ingress nginx-ingress-nginx-controller-6db6f85bc4-mfpwx), I can see below:</p>
  <p>192.168.134.181 - - [24/Apr/2021:19:02:01 +0000] &quot;GET /my-nginx HTTP/2.0&quot; 404 154 &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0&quot; 219 0.002 [eshop-dev-my-nginx-9443] [] 192.168.168.105:80 154 0.000 404 42fbe692a032bb40bf193954526369cd</p>
  <p>Here is my deployment yaml:</p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: my-nginx
    namespace: eshop-dev
  spec:
    selector:
      matchLabels:
        run: my-nginx
    replicas: 2
    template:
      metadata:
        labels:
          run: my-nginx
      spec:
        containers:
        - name: my-nginx
          image: nginx
          ports:
          - containerPort: 80
  </code></pre>
  <p>Service yaml:</p>
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    namespace: eshop-dev
    name: my-nginx
  spec:
    selector:
      run: my-nginx
    ports:
      - name: server
        port: 9443
        targetPort: 80
        protocol: TCP
  </code></pre>
  <p>and ingress yaml:</p>
  <pre><code>apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: test-ingress
    namespace: eshop-dev
    annotations:
      kubernetes.io/ingress.class: &quot;nginx&quot;
  spec:
    rules:
    - host: example.com
      http:
        paths:
        - path: /my-nginx
          pathType: ImplementationSpecific
          backend:
            service:
              name: my-nginx
              port:
                  number: 9443
    tls:
    - hosts:
      - example.com
      secretName: externaluicerts
  </code></pre>
  <p>I have verified that service returns the desired output, when used with port forwarding:</p>
  <pre><code>kubectl -n eshop-dev port-forward service/my-nginx 9443:9443
  </code></pre>
  <p>I'm not sure if the ingress is incorrectly configured or if it is another problem.Thanks in advance for the help!</p>
  <p><a href="https://i.stack.imgur.com/SJllT.png" rel="nofollow noreferrer">nginx-port-forward</a></p>
  <p>Here is the output of kubectl get ingress -n eshop-dev test-ingress -o yaml</p>
  <pre><code>kubectl get ingress -n eshop-dev test-ingress -o yaml
  Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
  apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {&quot;apiVersion&quot;:&quot;networking.k8s.io/v1&quot;,&quot;kind&quot;:&quot;Ingress&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{&quot;kubernetes.io/ingress.class&quot;:&quot;nginx&quot;},&quot;name&quot;:&quot;test-ingress&quot;,&quot;namespace&quot;:&quot;eshop-dev&quot;},&quot;spec&quot;:{&quot;rules&quot;:[{&quot;host&quot;:&quot;example.com&quot;,&quot;http&quot;:{&quot;paths&quot;:[{&quot;backend&quot;:{&quot;service&quot;:{&quot;name&quot;:&quot;my-nginx&quot;,&quot;port&quot;:{&quot;number&quot;:9443}}},&quot;path&quot;:&quot;/my-nginx&quot;,&quot;pathType&quot;:&quot;ImplementationSpecific&quot;}]}}],&quot;tls&quot;:[{&quot;hosts&quot;:[&quot;example.com&quot;],&quot;secretName&quot;:&quot;externaluicerts&quot;}]}}
      kubernetes.io/ingress.class: nginx
    creationTimestamp: &quot;2021-04-24T13:16:21Z&quot;
    generation: 13
    managedFields:
    - apiVersion: networking.k8s.io/v1beta1
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          f:loadBalancer:
            f:ingress: {}
      manager: nginx-ingress-controller
      operation: Update
      time: &quot;2021-04-24T13:16:40Z&quot;
    - apiVersion: extensions/v1beta1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations: {}
      manager: kubectl-client-side-apply
      operation: Update
      time: &quot;2021-04-24T13:18:36Z&quot;
    - apiVersion: networking.k8s.io/v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            f:kubectl.kubernetes.io/last-applied-configuration: {}
            f:kubernetes.io/ingress.class: {}
        f:spec:
          f:rules: {}
          f:tls: {}
      manager: kubectl-client-side-apply
      operation: Update
      time: &quot;2021-04-24T16:33:47Z&quot;
    name: test-ingress
    namespace: eshop-dev
    resourceVersion: &quot;7555944&quot;
    selfLink: /apis/extensions/v1beta1/namespaces/eshop-dev/ingresses/test-ingress
    uid: a7694655-20c6-48c7-8adc-cf3a53cf2ffe
  spec:
    rules:
    - host: example.com
      http:
        paths:
        - backend:
            serviceName: my-nginx
            servicePort: 9443
          path: /my-nginx
          pathType: ImplementationSpecific
    tls:
    - hosts:
      - example.com
      secretName: externaluicerts
  status:
    loadBalancer:
      ingress:
      - hostname: xxxxxxxxxxxxxxxxdc75878b2-433872486.eu-west-1.elb.amazonaws.com
  </code></pre>