<p>My Kubernetes cluster is running in Vmware PKS. </p>

<p>I am having <strong>Ingress</strong> resource with <strong>spec.rules.host: test.domain.com</strong> for backend service "test-service". I understand that by adding an entry in DNS server will route traffic to my cluster when accessed from outside of the cluster(external).
But without DNS entry in the server/cloud, I need to test the Ingress configuration locally by adding an entry to /etc/hosts or something like. </p>

<p>I found in a baremetal tutorial, adding the HA Proxy IP to /etc/hosts file redirects traffic to kubernetes cluster. Just like that, added the "ip_of_k8_cluster test.domain.com" to /etc/hosts the tried to access like "curl <a href="http://test.domain.com/" rel="nofollow noreferrer">http://test.domain.com/</a>" but the URL is not reachable. </p>

<p>How to verify(internal) the hostname in the Ingress resource without having actual DNS entry for host. I want to make sure my Ingress resource is perfectly working then I can request my company admin to add the name in DNS.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  namespace: ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: app-ingress
spec:
  rules:
  - host: test.domain.com
    http:
      paths:
      - backend:
          serviceName: test-service
          servicePort: 80
        path: /
</code></pre>

intechops6
<p>Use <code>curl</code> with the <code>--resolve</code> flag, example;</p>

<pre><code>host=test.domain.com
adr=&lt;your-external-or-loadbalancer-ip-for-the-nginx-service&gt;
curl -D - --resolv $host:80:$adr http://$host/
</code></pre>

<p>Or with https;</p>

<pre><code>curl -D - --resolv $host:443:$adr --insecure https://$host/
</code></pre>
