<p><strong>EDIT:</strong></p>
<p>I deleted minikube, enabled kubernetes in Docker desktop for Windows and installed <code>ingress-nginx</code> manually.</p>
<pre><code>$helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace
Release &quot;ingress-nginx&quot; does not exist. Installing it now.
Error: rendered manifests contain a resource that already exists. Unable to continue with install: ServiceAccount &quot;ingress-nginx&quot; in namespace &quot;ingress-nginx&quot; exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: missing key &quot;meta.helm.sh/release-name&quot;: must be set to &quot;ingress-nginx&quot;; annotation validation error: missing key &quot;meta.helm.sh/release-namespace&quot;: must be set to &quot;ingress-nginx&quot;
</code></pre>
<p>It gave me an error but I think it's because I did it already before because:</p>
<pre><code>$kubectl get svc -n ingress-nginx
NAME                                 TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-controller             LoadBalancer   10.106.222.233   localhost     80:30199/TCP,443:31093/TCP   11m
ingress-nginx-controller-admission   ClusterIP      10.106.52.106    &lt;none&gt;        443/TCP                      11m
</code></pre>
<p>Then applied all my yaml files again but this time ingress is not getting any address:</p>
<pre><code>$kubectl get ing
NAME                CLASS    HOSTS       ADDRESS   PORTS   AGE
myapp-ingress       &lt;none&gt;   myapp.com             80      10m
</code></pre>
<hr />
<p>I am using docker desktop (windows) and installed nginx-ingress controller via minikube addons enable command:</p>
<pre><code>$kubectl get pods -n ingress-nginx
NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx-admission-create--1-lp4md     0/1     Completed   0          67m
ingress-nginx-admission-patch--1-jdkn7      0/1     Completed   1          67m
ingress-nginx-controller-5f66978484-6mpfh   1/1     Running     0          67m
</code></pre>
<p>And applied all my yaml files:</p>
<pre><code>$kubectl get svc --all-namespaces -o wide
NAMESPACE       NAME                                 TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE   SELECTOR
default         event-service-svc                    ClusterIP      10.108.251.79    &lt;none&gt;        80/TCP                       16m   app=event-service-app
default         kubernetes                           ClusterIP      10.96.0.1        &lt;none&gt;        443/TCP                      16m   &lt;none&gt;
default         mssql-clusterip-srv                  ClusterIP      10.98.10.22      &lt;none&gt;        1433/TCP                     16m   app=mssql
default         mssql-loadbalancer                   LoadBalancer   10.109.106.174   &lt;pending&gt;     1433:31430/TCP               16m   app=mssql
default         user-service-svc                     ClusterIP      10.111.128.73    &lt;none&gt;        80/TCP                       16m   app=user-service-app
ingress-nginx   ingress-nginx-controller             NodePort       10.101.112.245   &lt;none&gt;        80:31583/TCP,443:30735/TCP   68m   app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx
ingress-nginx   ingress-nginx-controller-admission   ClusterIP      10.105.169.167   &lt;none&gt;        443/TCP                      68m   app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-nginx,app.kubernetes.io/name=ingress-nginx
kube-system     kube-dns                             ClusterIP      10.96.0.10       &lt;none&gt;        53/UDP,53/TCP,9153/TCP       72m   k8s-app=kube-dns
</code></pre>
<p>All pods and services seems to be running properly. Checked the pod logs, all migrations etc. has worked and app is up and running. But when I try to send an HTTP request, I get a socket hang up error. I've checked all the logs for all pods, couldn't find anything useful.</p>
<pre><code>$kubectl get ingress
NAME                CLASS   HOSTS           ADDRESS     PORTS   AGE
myapp-ingress   nginx   myapp.com       localhost   80      74s
</code></pre>
<p>This one is also a bit weird, I was expecting ADRESS to be set to an IP not to localhost. So adding 127.0.0.1 entry for myapp.com in /etc/hosts also didn't seem so right.</p>
<p>My question here is what I might be doing wrong? Or how can I even trace where are my requests are being forwarded to?</p>
<p>ingress-svc.yaml</p>
<pre><code>  apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: myapp-ingress
    spec:
      rules:
      - host: myapp.com
        http:
          paths:
          - path: /api/Users
            pathType: Prefix
            backend:
              service:
                name: user-service-svc
                port:
                  number: 80
          - path: /api/Events
            pathType: Prefix
            backend:
              service:
                name: event-service-svc
                port:
                  number: 80
</code></pre>
<p>events-depl.yaml:</p>
<pre><code>  apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: event-service-app
      labels:
        app: event-service-app
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: event-service-app
      template:
        metadata:
          labels:
            app: event-service-app
        spec:
          containers:
            - name: event-service-app
              image: ghcr.io/myapp/event-service:master
              imagePullPolicy: Always
              ports:
                - containerPort: 80
          imagePullSecrets:
            - name: myapp
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: event-service-svc
    spec:
      selector:
        app: event-service-app
      ports:
        - protocol: TCP
          port: 80
          targetPort: 80
</code></pre>

<h2>Reproduction</h2>
<p>I reproduced the case using minikube <code>v1.24.0</code>, Docker desktop <code>4.2.0</code>, engine <code>20.10.10</code></p>
<p>First, <code>localhost</code> in ingress appears due to logic, it doesn't really matter what IP address is behind the domain in <code>/etc/hosts</code>, I added a different one for testing and still it showed localhost. Only <code>metallb</code> will provide an IP address from set up network.</p>
<h2>What happens</h2>
<p>When minikube driver is <code>docker</code>, minikube creates a big container (VM) where kubernetes components are run. This can be checked by running <code>docker ps</code> command in host system:</p>
<pre><code>$ docker ps

CONTAINER ID   IMAGE                                 COMMAND                  CREATED          STATUS          PORTS                                                                                                                                  NAMES
f087dc669944   gcr.io/k8s-minikube/kicbase:v0.0.28   &quot;/usr/local/bin/entr…&quot;   16 minutes ago   Up 16 minutes   127.0.0.1:59762-&gt;22/tcp, 127.0.0.1:59758-&gt;2376/tcp, 127.0.0.1:59760-&gt;5000/tcp, 127.0.0.1:59761-&gt;8443/tcp, 127.0.0.1:59759-&gt;32443/tcp   minikube
</code></pre>
<p>And then <code>minikube ssh</code> to get inside this container and run <code>docker ps</code> to see all kubernetes containers.</p>
<p>Moving forward. Before introducing <code>ingress</code>, it's already clear that even <code>NodePort</code> doesn't work as intended. Let's check it.</p>
<p>There are two ways to get <code>minikube VM IP</code>:</p>
<ol>
<li>run <code>minikube IP</code></li>
<li><code>kubectl get nodes -o wide</code> and find the node's IP</li>
</ol>
<p>What should happen next with <code>NodePort</code> is requests should go to <code>minikube_IP:Nodeport</code> while it doesn't work. It happens because docker containers inside the minikube VM are not exposed outside of the cluster which is another docker container.</p>
<p>On <code>minikube</code> to access services within cluster there is a special command - <a href="https://minikube.sigs.k8s.io/docs/commands/service/" rel="nofollow noreferrer"><code>minikube service %service_name%</code></a> which will create a direct tunnel to the service inside the <code>minikube VM</code> (you can see that it contains <code>service URL</code> with <code>NodePort</code> which is supposed to be working):</p>
<pre><code>$ minikube service echo

|-----------|------|-------------|---------------------------|
| NAMESPACE | NAME | TARGET PORT |            URL            |
|-----------|------|-------------|---------------------------|
| default   | echo |        8080 | http://192.168.49.2:32034 |
|-----------|------|-------------|---------------------------|
* Starting tunnel for service echo.
|-----------|------|-------------|------------------------|
| NAMESPACE | NAME | TARGET PORT |          URL           |
|-----------|------|-------------|------------------------|
| default   | echo |             | http://127.0.0.1:61991 |
|-----------|------|-------------|------------------------|
* Opening service default/echo in default browser...
! Because you are using a Docker driver on windows, the terminal needs to be open to run it
</code></pre>
<p>And now it's available on host machine:</p>
<pre><code>$ curl http://127.0.0.1:61991/

StatusCode        : 200
StatusDescription : OK
</code></pre>
<h2>Adding ingress</h2>
<p>Moving forward and adding ingress.</p>
<pre><code>$ minikube addons enable ingress
$ kubectl get svc -A

NAMESPACE       NAME                                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
default         echo                                 NodePort    10.111.57.237   &lt;none&gt;        8080:32034/TCP               25m
ingress-nginx   ingress-nginx-controller             NodePort    10.104.52.175   &lt;none&gt;        80:31041/TCP,443:31275/TCP   2m12s
</code></pre>
<p>Trying to get any response from <code>ingress</code> by hitting <code>minikube_IP:NodePort</code> with no luck:</p>
<pre><code>$ curl 192.168.49.2:31041

curl : Unable to connect to the remote server
At line:1 char:1
+ curl 192.168.49.2:31041
</code></pre>
<p>Trying to create a tunnel with <code>minikube service</code> command:</p>
<pre><code>$ minikube service ingress-nginx-controller -n ingress-nginx

|---------------|--------------------------|-------------|---------------------------|
|   NAMESPACE   |           NAME           | TARGET PORT |            URL            |
|---------------|--------------------------|-------------|---------------------------|
| ingress-nginx | ingress-nginx-controller | http/80     | http://192.168.49.2:31041 |
|               |                          | https/443   | http://192.168.49.2:31275 |
|---------------|--------------------------|-------------|---------------------------|
* Starting tunnel for service ingress-nginx-controller.
|---------------|--------------------------|-------------|------------------------|
|   NAMESPACE   |           NAME           | TARGET PORT |          URL           |
|---------------|--------------------------|-------------|------------------------|
| ingress-nginx | ingress-nginx-controller |             | http://127.0.0.1:62234 |
|               |                          |             | http://127.0.0.1:62235 |
|---------------|--------------------------|-------------|------------------------|
* Opening service ingress-nginx/ingress-nginx-controller in default browser...
* Opening service ingress-nginx/ingress-nginx-controller in default browser...
! Because you are using a Docker driver on windows, the terminal needs to be open to run it.
</code></pre>
<p>And getting <code>404</code> from <code>ingress-nginx</code> which means we can send requests to ingress:</p>
<pre><code>$ curl http://127.0.0.1:62234

curl : 404 Not Found
nginx
At line:1 char:1
+ curl http://127.0.0.1:62234
</code></pre>
<h2>Solutions</h2>
<p>Above I explained what happens. Here are three solutions how to get it work:</p>
<ol>
<li>Use another <a href="https://minikube.sigs.k8s.io/docs/drivers/" rel="nofollow noreferrer">minikube driver</a> (e.g. virtualbox. I used <code>hyperv</code> since my laptop has windows 10 pro)</li>
</ol>
<p><code>minikube ip</code> will return &quot;normal&quot; IP address of virtual machine and all network functionality will work just fine. You will need to add this IP address into <code>/etc/hosts</code> for domain used in ingress rule</p>
<p><strong>Note!</strong> Even though <code>localhost</code> was shown in <code>kubectl get ing ingress</code> output in <code>ADDRESS</code>.</p>
<ol start="2">
<li>Use built-in kubernetes feature in Docker desktop for Windows.</li>
</ol>
<p>You will need to <a href="https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal-clusters" rel="nofollow noreferrer">manually install <code>ingress-nginx</code></a> and change <code>ingress-nginx-controller</code> service type from <code>NodePort</code> to <code>LoadBalancer</code> so it will be available on <code>localhost</code> and will be working. Please find <a href="https://stackoverflow.com/a/69113528/15537201">my another answer about Docker desktop for Windows</a></p>
<ol start="3">
<li>(testing only) - use port-forward</li>
</ol>
<p>It's almost exactly the same idea as <code>minikube service</code> command. But with more control. You will open a tunnel from host VM port <code>80</code> to <code>ingress-nginx-controller</code> service (eventually pod) on port <code>80</code> as well. <code>/etc/hosts</code> should contain <code>127.0.0.1 test.domain</code> entity.</p>
<pre><code>$ kubectl port-forward service/ingress-nginx-controller -n ingress-nginx 80:80

Forwarding from 127.0.0.1:80 -&gt; 80
Forwarding from [::1]:80 -&gt; 80
</code></pre>
<p>And testing it works:</p>
<pre><code>$ curl test.domain

StatusCode        : 200
StatusDescription : OK
</code></pre>
<h2>Update for kubernetes in docker desktop on windows and ingress:</h2>
<p>On modern <code>ingress-nginx</code> versions <code>.spec.ingressClassName</code> should be added to ingress rules. See <a href="https://kubernetes.github.io/ingress-nginx/#i-have-only-one-instance-of-the-ingresss-nginx-controller-in-my-cluster-what-should-i-do" rel="nofollow noreferrer">last updates</a>, so ingress rule should look like:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
...
spec:
  ingressClassName: nginx # can be checked by kubectl get ingressclass
  rules:
  - host: myapp.com
    http:
      ...
</code></pre>
