<p>I'm new to k8s. I deployed an ingress on minikube, and I found out its address to be <code>localhost</code> which it shouldn't be, I guess. For this, I don't know how to continue, for I should edit <code>/etc/hosts/</code> to add dns item, but no I could not.<br />
<a href="https://i.stack.imgur.com/UPwcf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UPwcf.png" alt="enter image description here" /></a></p>
<p>And this is my configuration file</p>
<pre><code>kiloson@ubuntu:~$ cat kubia-ingress.yaml 
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kubia
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: kubia.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service: 
            name: kubia-nodeport
            port: 
              number: 80
</code></pre>
<p>minikube version</p>
<pre><code>kiloson@ubuntu:~$ minikube version
minikube version: v1.24.0
commit: 76b94fb3c4e8ac5062daf70d60cf03ddcc0a741b
</code></pre>
<p>Ubuntu Info</p>
<pre><code>kiloson@ubuntu:~$ neofetch
            .-/+oossssoo+/-.               kiloson@ubuntu 
        `:+ssssssssssssssssss+:`           -------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.3 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: Virtual Machine 7.0 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.11.0-1022-azure 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 2 hours, 33 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 648 (dpkg), 4 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Terminal: /dev/pts/0 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel Xeon E5-2673 v4 (2) @ 2.294GHz 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   GPU: 00:08.0 Microsoft Corporation Hyper-V virtual VGA 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Memory: 1493MiB / 7959MiB 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/                            
  +sssssssssdmydMMMMMMMMddddyssssssss+                             
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.
</code></pre>

<p>I was butting heads with this for a while and just got it working, so I'll add color to the other answers.</p>
<p>First of all, as pointed out in <a href="https://serverfault.com/questions/1052349/unable-to-connect-to-minikube-ingress-via-minikube-ip">this related question</a>, when you intially run <code>minikube addons enable ingress</code> it prints <code>After the addon is enabled, please run &quot;minikube tunnel&quot; and your ingress resources would be available at &quot;127.0.0.1&quot;</code>.</p>
<p>After completing the steps in the <a href="https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/" rel="noreferrer">tutorial</a> and running into the issue in this question, I was able to hit the hello-world app by starting <code>minikube tunnel</code> and adding <code>127.0.0.1 hello-world.info</code> to my <code>/etc/hosts</code>.</p>
<p>I am not sure why the tutorial execution of <code>kubectl get ingress</code> returns a non-localhost IP, but returns <code>localhost</code> when running locally, but it seems like the primary issue here is that while you are creating an ingress on the docker containers running minikube, you need to forward traffic to the containers through <code>minikube tunnel</code> to hit the now open ingress in minikube.</p>
