<p>I'm trying to learn nginx-ingress-controller per <a href="https://devopscube.com/setup-ingress-kubernetes-nginx-controller" rel="nofollow noreferrer">https://devopscube.com/setup-ingress-kubernetes-nginx-controller</a></p>
<p>my laptop is at 192.168.12.71</p>
<p>my ingress-nginx-controller pod and service is at 192.168.1.67.</p>
<p>a. Pod</p>
<pre><code> bino@corobalap  ~/k8nan/ingresnginx/nginx-ingress-controller   bino01 ±  kubectl --namespace ingress-nginx describe pod ingress-nginx-controller
Name:         ingress-nginx-controller-78f456c879-w6pbd
Namespace:    ingress-nginx
Priority:     0
Node:         bino-k8-wnode1/192.168.1.67
Start Time:   Tue, 19 Jul 2022 12:49:19 +0700
Labels:       app.kubernetes.io/component=controller
              app.kubernetes.io/instance=ingress-nginx
              app.kubernetes.io/name=ingress-nginx
              pod-template-hash=78f456c879
Annotations:  &lt;none&gt;
Status:       Running
IP:           192.168.1.67
IPs:
  IP:           192.168.1.67
Controlled By:  ReplicaSet/ingress-nginx-controller-78f456c879
Containers:
  controller:
    Container ID:  containerd://8606c2dd3800502eb56dd6de2decab93f2b9567916b462a83acf8917bcb7696d
    Image:         k8s.gcr.io/ingress-nginx/controller:v1.1.1
    Image ID:      k8s.gcr.io/ingress-nginx/controller@sha256:0bc88eb15f9e7f84e8e56c14fa5735aaa488b840983f87bd79b1054190e660de
    Ports:         80/TCP, 443/TCP, 8443/TCP
    Host Ports:    80/TCP, 443/TCP, 8443/TCP
    Args:
      /nginx-ingress-controller
      --publish-service=$(POD_NAMESPACE)/ingress-nginx-controller
      --election-id=ingress-controller-leader
      --controller-class=k8s.io/ingress-nginx
      --configmap=$(POD_NAMESPACE)/ingress-nginx-controller
      --validating-webhook=:8443
      --validating-webhook-certificate=/usr/local/certificates/cert
      --validating-webhook-key=/usr/local/certificates/key
    State:          Running
      Started:      Tue, 19 Jul 2022 12:49:21 +0700
    Ready:          True
    Restart Count:  0
    Requests:
      cpu:      100m
      memory:   90Mi
    Liveness:   http-get http://:10254/healthz delay=10s timeout=1s period=10s #success=1 #failure=5
    Readiness:  http-get http://:10254/healthz delay=10s timeout=1s period=10s #success=1 #failure=3
    Environment:
      POD_NAME:       ingress-nginx-controller-78f456c879-w6pbd (v1:metadata.name)
      POD_NAMESPACE:  ingress-nginx (v1:metadata.namespace)
      LD_PRELOAD:     /usr/local/lib/libmimalloc.so
    Mounts:
      /usr/local/certificates/ from webhook-cert (ro)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-5tzs5 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  webhook-cert:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  ingress-nginx-admission
    Optional:    false
  kube-api-access-5tzs5:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       &lt;nil&gt;
    DownwardAPI:             true
QoS Class:                   Burstable
Node-Selectors:              kubernetes.io/os=linux
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:                      &lt;none&gt;
</code></pre>
<p>b. service :</p>
<pre><code> ✘ bino@corobalap  ~/k8nan/ingresnginx/nginx-ingress-controller   bino01 ±  kubectl --namespace ingress-nginx describe service ingress-nginx-controller
Name:                     ingress-nginx-controller
Namespace:                ingress-nginx
Labels:                   app.kubernetes.io/component=controller
                          app.kubernetes.io/instance=ingress-nginx
                          app.kubernetes.io/name=ingress-nginx
Annotations:              &lt;none&gt;
Selector:                 app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.109.72.34
IPs:                      10.109.72.34
Port:                     http  80/TCP
TargetPort:               http/TCP
NodePort:                 http  31324/TCP
Endpoints:                192.168.1.67:80
Port:                     https  443/TCP
TargetPort:               https/TCP
NodePort:                 https  31645/TCP
Endpoints:                192.168.1.67:443
Session Affinity:         None
External Traffic Policy:  Local
Events:                   &lt;none&gt;
</code></pre>
<p>my hello-app pod and service and ingress object also at 192.168.1.67</p>
<p>a. pod :</p>
<pre><code> bino@corobalap  ~/k8nan/ingresnginx/nginx-ingress-controller   bino01 ±  kubectl --namespace dev describe pod hello-app
Name:         hello-app-5c554f556c-4jhhv
Namespace:    dev
Priority:     0
Node:         bino-k8-wnode1/192.168.1.67
Start Time:   Tue, 19 Jul 2022 11:45:09 +0700
Labels:       app=hello
              pod-template-hash=5c554f556c
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.244.1.19
IPs:
  IP:           10.244.1.19
Controlled By:  ReplicaSet/hello-app-5c554f556c
Containers:
  hello:
    Container ID:   containerd://8f4c02f60c82a70db4f7d0954ee19f606493a6ee5517d0d0f7641429682d86fb
    Image:          gcr.io/google-samples/hello-app:2.0
    Image ID:       gcr.io/google-samples/hello-app@sha256:2b0febe1b9bd01739999853380b1a939e8102fd0dc5e2ff1fc6892c4557d52b9
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Running
      Started:      Tue, 19 Jul 2022 11:45:16 +0700
    Ready:          True
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-6zghn (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-6zghn:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       &lt;nil&gt;
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              &lt;none&gt;
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:                      &lt;none&gt;

Name:         hello-app-5c554f556c-c879k
Namespace:    dev
Priority:     0
Node:         bino-k8-wnode1/192.168.1.67
Start Time:   Tue, 19 Jul 2022 11:45:09 +0700
Labels:       app=hello
              pod-template-hash=5c554f556c
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.244.1.21
IPs:
  IP:           10.244.1.21
Controlled By:  ReplicaSet/hello-app-5c554f556c
Containers:
  hello:
    Container ID:   containerd://37ff6a278c3e5398ff3c70d1b2db47bfaa421a757eefaf4f34befa83b9fd8569
    Image:          gcr.io/google-samples/hello-app:2.0
    Image ID:       gcr.io/google-samples/hello-app@sha256:2b0febe1b9bd01739999853380b1a939e8102fd0dc5e2ff1fc6892c4557d52b9
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Running
      Started:      Tue, 19 Jul 2022 11:45:17 +0700
    Ready:          True
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-xr2hw (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-xr2hw:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       &lt;nil&gt;
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              &lt;none&gt;
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:                      &lt;none&gt;

Name:         hello-app-5c554f556c-n8pf8
Namespace:    dev
Priority:     0
Node:         bino-k8-wnode1/192.168.1.67
Start Time:   Tue, 19 Jul 2022 11:45:09 +0700
Labels:       app=hello
              pod-template-hash=5c554f556c
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.244.1.20
IPs:
  IP:           10.244.1.20
Controlled By:  ReplicaSet/hello-app-5c554f556c
Containers:
  hello:
    Container ID:   containerd://833ac8b81b454261b472cf8e2d790cdf712a2e038074acd8d53563c25c677bdd
    Image:          gcr.io/google-samples/hello-app:2.0
    Image ID:       gcr.io/google-samples/hello-app@sha256:2b0febe1b9bd01739999853380b1a939e8102fd0dc5e2ff1fc6892c4557d52b9
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Running
      Started:      Tue, 19 Jul 2022 11:45:17 +0700
    Ready:          True
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-2hh5w (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-2hh5w:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       &lt;nil&gt;
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              &lt;none&gt;
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:                      &lt;none&gt;
</code></pre>
<p>b. service</p>
<pre><code> bino@corobalap  ~/k8nan/ingresnginx/nginx-ingress-controller   bino01 ±  kubectl --namespace dev describe service hello-service
Name:              hello-service
Namespace:         dev
Labels:            app=hello
Annotations:       &lt;none&gt;
Selector:          app=hello
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.97.83.176
IPs:               10.97.83.176
Port:              &lt;unset&gt;  80/TCP
TargetPort:        8080/TCP
Endpoints:         10.244.1.19:8080,10.244.1.20:8080,10.244.1.21:8080
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>
<p>c. ingress object</p>
<pre><code> ✘ bino@corobalap  ~/k8nan/ingresnginx/nginx-ingress-controller   bino01 ±  kubectl --namespace dev describe ingress hello-app-ingress
Name:             hello-app-ingress
Labels:           &lt;none&gt;
Namespace:        dev
Address:          
Ingress Class:    nginx
Default backend:  &lt;default&gt;
Rules:
  Host        Path  Backends
  ----        ----  --------
  kopet.kpt   
              /   hello-service:80 (10.244.1.19:8080,10.244.1.20:8080,10.244.1.21:8080)
Annotations:  &lt;none&gt;
Events:       &lt;none&gt;
</code></pre>
<p>I tried to access hello-service localy at node where it life, got:</p>
<pre><code>ubuntu@bino-k8-wnode1:~$ curl http://10.244.1.19:8080
Hello, world!
Version: 2.0.0
Hostname: hello-app-5c554f556c-4jhhv
</code></pre>
<p>I set a dummy hostname 'kopet.kpt' to point to the node where all the things life.
but when i tried to curl from my laptop, nginx say 404</p>
<pre><code> bino@corobalap  ~/k8nan/ingresnginx/nginx-ingress-controller   bino01 ±  curl http://kopet.kpt/
&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&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>Kindly please tell me what todo/read to fix it</p>
<p>-bino-</p>

Bino Oetomo
<p>Your ingress definition created rules that proxy traffic from one path to another. In your case I believe the reason it's not working is that the app is proxied to app-service:80/app but your intending on serving traffic at the /root. Please try adding this annotation to your ingress resource:</p>
<p>nginx.ingress.kubernetes.io/rewrite-target: / <a href="https://github.com/kubernetes/ingress-nginx/tree/master/docs/examples/rewrite" rel="nofollow noreferrer">Refer</a> github link for more information.</p>
<p>Also, please provide a complete error message.</p>
