<p>I saw some example where the Kubernetes cluster is installed with ingress controller and then the ingress class is added with annotations and host as below.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
 annotations:
    kubernetes.io/ingress.class: nginx

spec:
 rules:
   - host: testsvc.k8s.privatecloud.com
     http:
</code></pre>

<p>I am not sure which service is installed and which IP is configured with the DNS <strong>"k8s.privatecloud.com"</strong> so as to route requests?
How the DNS routing <strong>"k8s.privatecloud.com"</strong> routes requests to Kubernetes cluster? How the ingress to kubernetes bridging works?</p>

<p>Also, There could be many services configured with the hosts rule like,</p>

<pre><code>testsvc.k8s.privatecloud.com
testsvc1.k8s.privatecloud.com
testsvc2.k8s.privatecloud.com
</code></pre>

<p>How the subdomain routing works here when we hit the service testsvc.k8s.privatecloud.com or testsvc1.k8s.privatecloud.com ...</p>

<p>Thanks</p>

<p>The DNS for all the hostnames in your given example (e.g. <code>testsvc.k8s.privatecloud.com</code>) would point to the machine or load-balancer through which traffic will reach the Ingress controller's nginx, as is described in <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">the kuberetes Ingress documentation</a></p>

<p>Subdomain routing is traditionally done via "virtual-hosting", sometimes called "v-host-ing", and the nginx ingress uses the HTTP <code>Host:</code> header to know which backend service should receive that traffic. Some Ingress controllers are able to use SNI for that same trick over https.</p>
