Ingress Host Based routing rule

Please take time to read this. Thanks!!!

I’m running 2 deployments with clusterip as the service for each of them, inside 3 VM kubernetes cluster setup inside VirtualBox.

I have deployed nginx ingress controller with ingress rules as host based routing(check screenshot).

Ex: routes to one service and routes to second service. kindly check screenshot for the yaml.

After deploying the nginx igress controller with nodeport service,i got the endpoints for nodeport service i.e., 80:32174/TCP,443:32088/TCP

I have HAProxy running in a separate VM which is configured to reach all k8s nodes using :32174(which is ingress controller’s node port).

I have created 2 dummy DNS entries in windows host machine(where VirtualBox is installed and hosting k8s cluster)that points to IP of HAProxy machines.

So, now i can simply visit any of the above URL’s ( & windows broswer and it gets redirected to HA proxy and HAproxy forwards the request to any of the K8s nodes and

ingress controller forwards this request to correct service according to ingress rules(check screenshot).

My question is how ingress controller is able to route the request to correct service depending on the URL, when everything is being

resolved into IPs.

When i curl the URL from windows host, it simply resolves to a IP(which is HAProxy IP)and HA simply routes to backend IPs.

In this case how ingress controllers actually understands the host based route( when everything is IP behind?

How the URL on the windows being understood by K8s ingress controller when there is no direct link?

Sorry if i’m wrong or took your time.