<p>I was trying to use Kubernetes to set up a service locally. I am using ingress-nginx for routing. I am using Ubuntu 18.04. This is my ingress.yaml file:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata: 
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: 'true'
spec: 
  rules:
    - host: ecommerce.dev
      http:   
        paths: 
          - path: /api/users/?(.*) 
            backend: 
              serviceName: auth-srv
              servicePort: 3000
</code></pre>
<p>Also, I mapped this in my <code>/etc/hosts/</code> file:</p>
<pre><code>127.0.0.1   localhost
127.0.1.1   TALHA

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.0.1 ecommerce.dev
</code></pre>
<p>When I try to reach 'ecommerce.dev' from my browser, I am unable to access it as it says 'Site can not be reached'. Can someone please help me about it?</p>

<p>I saw you mentioned you are using minikube with nginx ingress addon.</p>
<p>This information helps a lot. Try not to skip this kind of information in future. I was assuming that by saying <em>&quot;I was trying to use Kubernetes to set up a service locally&quot;</em> you mean that you run baremetal k8s.</p>
<p>Minikube is most probably running in a VM and this is why you cannot access it.</p>
<p>Running <code>minikube ip</code> gives you the IP address of a VM:</p>
<pre><code>$ minikube ip
192.168.39.67
</code></pre>
<p>Your ip may be different so don't use my IP, check what IP you got assigned.</p>
<p>Now that you have the IP of a minikube VM, use it in <code>/etc/hosts</code>. In my case it looks like following:</p>
<pre><code>192.168.39.67 ecommerce.dev
</code></pre>
