Hi @Alistair Mackay @unnivkn @Mumshad Mannambeth I'm working on Lightning Lab-2 . . .

Kevin Patel:
Hi @Alistair Mackay @unnivkn @Mumshad Mannambeth I’m working on Lightning Lab-2 Q.4
Create a single ingress resource called ingress-vh-routing. The resource should route HTTP traffic to multiple hostnames as specified below:
The service video-service should be accessible on http://watch.ecom-store.com:30093/video
The service apparels-service should be accessible on http://apparels.ecom-store.com:30093/wear
Here 30093 is the port used by the Ingress Controller
Ingress resource configured correctly?

Answer:

k create ingress ingress-vh-routing --rule=“http://watch.ecom-store.com/video=video-service:8080|watch.ecom-store.com/video=video-service:8080” --rule=“http://apparels.ecom-store.com/wear=apparels-service:8080|apparels.ecom-store.com/wear=apparels-service:8080” --annotation=“http://nginx.ingress.kubernetes.io/rewrite-target=/|nginx.ingress.kubernetes.io/rewrite-target=/” --annotation=“http://nginx.ingress.kubernetes.io/ssl-redirect=false|nginx.ingress.kubernetes.io/ssl-redirect=false

Now after creating ingress, I’m trying to confirm it’s working as expected using

controlplane ~ ➜ curl -H “Host:http://watch.ecom-store.com|watch.ecom-store.com” 10.106.227.249 (This IP is retrieved using k describe ingress ingress-vh-routing and It’s value of Address field which is same as ingress-controller svc IP)

I’ve added redirect-target and ssl-redirect annotations but still getting 404, do you know why? and in general, what’s the best way to troubleshoot ingress related issues?

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

Alistair Mackay:
Hi @Kevin Patel
You’re looking in the wrong place for the endpoint of the ingress.

You need to examine the ingress controller’s service

k get service -n ingress-nginx ingress-nginx-controller

You will notice that it is a NodePort service, so note the node port. It’s the same as the port in the question.
Now find the IP of a node (different each time you load the lab).

k get node -o wide

When I ran it, I got 10.20.241.3
Finally, form the curl commands with this information

curl -H "Host: <http://watch.ecom-store.com|watch.ecom-store.com>" <http://10.20.241.3:30093/video>
curl -H "Host: <http://apparels.ecom-store.com|apparels.ecom-store.com>" <http://10.20.241.3:30093/wear>

OTOH, were the ingress controller’s service of type LoadBalancer then you would hit that service’s External IP on port 80

Kevin Patel:
Thank you @Alistair Mackay.