<p>This question might be silly, but i wanted to clear my doubts.</p>
<p>From the below example, we can access this ingress using host specified.
<strong>For Example:</strong> Accessing this url(in browser/curl) <strong><a href="http://www.foo.bar.com/bar" rel="nofollow noreferrer">www.foo.bar.com/bar</a></strong>, will route traffic to &quot;service1&quot;</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-wildcard-host
spec:
  rules:
  - host: &quot;foo.bar.com&quot;
    http:
      paths:
      - pathType: Prefix
        path: &quot;/bar&quot;
        backend:
          service:
            name: service1
            port:
              number: 80
#take from K8S Doc
</code></pre>
<p>How can i access below ingress, without created host like below?</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ing
spec:
  rules:
    - http:
        paths:
        - backend:
            serviceName: service1
            servicePort: 80
</code></pre>

Prakash26790
<p>If you provide <code>host</code> then all the traffic which matches the host will be checked for your path (those are given). But if you do not provide host then ingress will check the path all kind of traffics.</p>
<p>For example, if you set <code>host: &quot;foo.bar.com&quot;</code> then all the traffic coming with <code>foo.bar.com</code> will be checked for the <code>path: /testpath</code>, but if you use below yaml then all kinds of traffic will be checked for <code>path: /testpath</code> (either it comes from <code>oka.bar.com</code> or others)</p>
<p>You can use like this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        pathType: Prefix
        backend:
          service:
            name: test
            port:
              number: 80
</code></pre>
