<p>I'm following the <a href="https://www.youtube.com/watch?v=DgVjEo3OGBI" rel="nofollow noreferrer">tutorial</a> from Less Jackson about Kubernetes but I'm stuck around 04:40:00. I always get an 404 returned from my Ingress Nginx Controller. I followed everything he does, but I can't get it to work.</p>
<p>I also read that this could have something to do with IIS, so I stopped the default website which also runs on port 80.</p>
<p>The apps running in the containers are .NET Core.</p>
<p><strong>Commands-deply &amp; cluster ip</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
 name: commands-depl
spec:
 replicas: 1
 selector:
  matchLabels:
   app: commandservice
 template:
  metadata:
   labels:
    app: commandservice
  spec:
   containers:
    - name: commandservice
      image: maartenvissershub/commandservice:latest
---
apiVersion: v1
kind: Service
metadata:
 name: commands-clusterip-srv
spec:
 type: ClusterIP
 selector:
  app: commandservice
 ports:
  - name: commandservice
    protocol: TCP
    port: 80
    targetPort: 80
</code></pre>
<p><strong>Platforms-depl &amp; cluster ip</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
 name: platforms-depl
spec:
 replicas: 1
 selector:
  matchLabels:
   app: platformservice
 template:
  metadata:
   labels:
    app: platformservice
  spec:
   containers:
    - name: platformservice
      image: maartenvissershub/platformservice:latest
---
apiVersion: v1
kind: Service
metadata:
 name: platforms-clusterip-srv
spec:
 type: ClusterIP
 selector:
  app: platformservice
 ports:
  - name: platformservice
    protocol: TCP
    port: 80
    targetPort: 80
</code></pre>
<p><strong>Ingress-srv</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
 name: ingress-srv
 annotations:
  kubernetes.io/ingress.class: nginx
  nginx.ingress.kubernetes.io/use-regex: 'true'
  nginx.ingress.kubernetes.io/rewrite-target: /
spec:
 rules:
  - host: acme.com
    http:
     paths:
      - path: /api/platforms
        pathType: Prefix
        backend:
         service:
          name: platforms-clusterip-srv
          port:
           number: 80
      - path: /api/c/platforms
        pathType: Prefix
        backend:
         service:
          name: commands-clusterip-srv
          port:
           number: 80
</code></pre>
<p>I also added this to my hosts file:
<code>127.0.0.1 acme.com</code></p>
<p>And I applied this from the nginx documentation:</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.3.0/deploy/static/provider/cloud/deploy.yaml
</code></pre>
<p><strong>kubectl get ingress</strong>
<a href="https://i.stack.imgur.com/YmKBU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YmKBU.png" alt="kubectl get ingress" /></a></p>
<p><strong>kubectl describe ing ingress-srv</strong>
<br />
<a href="https://i.stack.imgur.com/QuV8Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QuV8Q.png" alt="kubectl describe ing ingress-srv" /></a></p>
<p><strong>Dockerfile CommandService</strong></p>
<pre><code>FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT [ &quot;dotnet&quot;, &quot;PlatformService.dll&quot; ]
</code></pre>
<p><strong>kubectl logs ingress-nginx-controller-6bf7bc7f94-v2jnp  -n ingress-nginx</strong>
<a href="https://i.stack.imgur.com/Ir1HB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ir1HB.png" alt="LOGS INGRESS POD" /></a></p>
<p>Am I missing something?</p>

<p>I found my solution. There was a process running on port 80 with pid 4: 0.0.0.0:80. I could stop it using <code>NET stop HTTP</code> in an admin cmd.</p>
<p>I noticed that running <code>kubectl get services -n=ingress-nginx</code> resulted a ingress-nginx-controll, which is fine, but with an external-ip . Running <code>kubectl get ingress</code> also didn't show an ADDRESS. Now they both show &quot;localhost&quot; as value for external-ip and ADDRESS.</p>
<p>Reference: <a href="https://stackoverflow.com/a/26653919/12290439">Port 80 is being used by SYSTEM (PID 4), what is that?</a></p>
