<p>I am not able to match any path in the rules I've mentioned in ingress resource.
Only the default &quot;/&quot; maps to the service, other paths (shyam.local/sample for e.g) returns :</p>
<blockquote>
<p>Cannot GET /sample .</p>
</blockquote>
<p>Here's my ingress yaml :</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
   name: example-ingress
spec:
   rules:
    - host: &quot;shyam.local&quot;
      http:
          paths:
          - path: &quot;/&quot;
            pathType: Prefix
            backend:
              service:
                name: my-service
                port:
                  number: 3000
          - path: &quot;/sample&quot;
            pathType: Prefix
            backend:
              service:
                name: mongo-express-service
                port:
                  number: 8081    

</code></pre>
<p>Not sure if this means some harm , but i see an error in the default backend mentioned in the ingress
Here's my output for <code>kubectl describe ingress example-ingress</code></p>
<pre><code>Name:             example-ingress
Namespace:        default
Address:          192.168.43.130
Default backend:  default-http-backend:80 (&lt;error: endpoints &quot;default-http-backend&quot; not found&gt;)
Rules:
  Host         Path  Backends
  ----         ----  --------
  shyam.local  
               /         my-service:3000 (10.42.0.83:3000,10.42.0.84:3000,10.42.0.85:3000 + 1 more...)
               /sample   mongo-express-service:8081 (10.42.0.62:8081)
Annotations:   &lt;none&gt;
Events:
  Type    Reason  Age                From                      Message
  ----    ------  ----               ----                      -------
  Normal  Sync    13m (x6 over 41m)  nginx-ingress-controller  Scheduled for sync
</code></pre>
<p>I'm using nginx-ingress with k3s  as mentioned <a href="https://moonstreet.nl/post/k3s-with-ingress/" rel="nofollow noreferrer">here</a>.</p>
<p>Here's my output for <code>kubectl get all -n  ingress-nginx</code></p>
<pre><code>NAME                                            READY   STATUS      RESTARTS   AGE
pod/ingress-nginx-admission-create-bmn9s        0/1     Completed   0          59m
pod/ingress-nginx-admission-patch-6tx6l         0/1     Completed   1          59m
pod/ingress-nginx-controller-7d779d8ccf-d7ddv   1/1     Running     0          56m

NAME                                         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/ingress-nginx-controller-admission   ClusterIP   10.43.224.186   &lt;none&gt;        443/TCP                      59m
service/ingress-nginx-controller             NodePort    10.43.233.81    &lt;none&gt;        80:32069/TCP,443:31746/TCP   59m

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/ingress-nginx-controller   1/1     1            1           59m

NAME                                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/ingress-nginx-controller-7d779d8ccf   1         1         1       56m
replicaset.apps/ingress-nginx-controller-6cb6fdd64b   0         0         0       59m

NAME                                       COMPLETIONS   DURATION   AGE
job.batch/ingress-nginx-admission-create   1/1           21s        59m
job.batch/ingress-nginx-admission-patch    1/1           22s        59m

</code></pre>
<p>Any suggestions on what could be the reason for this ?</p>

nullPointerException
<p>Found the issue, it was due to a missing annotation in the Ingress resource.
For  posterity , Here's the updated yaml for ingress resource:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
   name: example-ingress
   annotations:
    # kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
   rules:
    - http:
          paths:
          - path: /sample
            pathType: Prefix
            backend:
              service:
                name: my-service  
                port:
                  number: 3000
          - path: /
            pathType: Prefix
            backend:
              service:
                name: mongo-express-service
                port:
                  number: 8081   
</code></pre>
