<p>I'm new to Ingress in Kubernetes. I installed Ingress NGINX controller in my AKS cluster. My application runs in a pod (Port 80) in testns (Namespace). I created a service for it in the same namespace. Now I want to access my application from outside. So I created an Ingress yaml for it.</p>
<p><strong>service.yaml</strong></p>
<pre><code> kubectl get svc -A | grep my-svc
    testns    my-svc                         ClusterIP      10.0.116.192   &lt;none&gt;          80/TCP                             93m
</code></pre>
<p><strong>ingress</strong></p>
<pre><code>Name:             example-ingress
Namespace:        testns
Address:
Default backend:  default-http-backend:80 (&lt;error: endpoints &quot;default-http-backend&quot; not found&gt;)
Rules:
  Host        Path  Backends
  ----        ----  --------
  *
              /apple   my-svc:80 (10.244.1.33:80)
Annotations:  ingress.kubernetes.io/rewrite-target: /
Events:       &lt;none&gt;
</code></pre>
<p><strong>ingress.yaml</strong></p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
        - path: /apple
          backend:
            serviceName: my-svc
            servicePort: 80
</code></pre>
<p>When I access using the <strong>&lt;IP_ADDRESS_OF_THE_INGRESS&gt;/apple</strong>, it gives an 404 error. I want to know why the application can't be accessed.</p>

Dusty
<p>Try adding the ingress class into YAML config <code>kubernetes.io/ingress.class: &quot;nginx&quot;</code></p>
<p>as annotation</p>
<pre><code>kubernetes.io/ingress.class: &quot;nginx&quot;
nginx.ingress.kubernetes.io/rewrite-target: /
</code></pre>
<p>Example</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
        - path: /apple
          backend:
            serviceName: my-svc
            servicePort: 80
</code></pre>
