<p>I am running docker on windows machine and trying to access the <a href="http://posts.com/posts" rel="nofollow noreferrer">http://posts.com/posts</a> as I get HTTP Error 404.0 - Not Found.</p>
<p>windows host config file has been configured correctly</p>
<p>127.0.0.1 posts.com</p>
<p>as I can browse to <a href="http://posts.com" rel="nofollow noreferrer">http://posts.com</a></p>
<p>I can also access using the port number <a href="http://posts.com:31783/posts" rel="nofollow noreferrer">http://posts.com:31783/posts</a>.</p>
<p>I am not sure why I cannot access over port 80.</p>
<p>following are the logs from kubernetes</p>
<p><a href="https://i.stack.imgur.com/XXHxm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XXHxm.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/0si3q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0si3q.png" alt="enter image description here" /></a></p>
<p>and ingress configuration</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata: 
    name: ingress-srv
    annotations: 
        kubernetes.io/ingress.class: nginx
spec:
  rules: 
    - host: posts.com
      http:
        paths:
          - path: /posts
            backend:
              serviceName: posts-clusterip-srv            
              servicePort: 4000
</code></pre>
<p>Deployment and Service file</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
    name: posts-depl
spec:
    replicas: 1
    selector:
        matchLabels:
            app: posts
    template:
        metadata:
            labels:
                app: posts
        spec:
            containers:
                - name: posts
                  image: nishank/posts:latest
---
apiVersion: v1
kind: Service
metadata:
    name: posts-clusterip-srv
spec:
    type: ClusterIP
    selector:
        app: posts
    ports:
        - name: posts
          protocol: TCP
          port: 4000
          targetPort: 4000
</code></pre>

Nishank
<p>Alright I finally have a solution to this issue.</p>
<p>First of all, this question is in reference to Stephen Grider's Microservices with Node JS and React course. I know this because the service/configuration attempted is straight from the course content.</p>
<p>There is something running on your Windows PC that is already using port 80, and that is why you receive a 404. To find out what process is doing this, first run the following inside a powershell / windows terminal instance:</p>
<pre><code>netstat -ano | findstr &quot;:80&quot; | findstr &quot;LISTENING&quot;
</code></pre>
<p>You will see something like the following:</p>
<pre><code>❯ netstat -ano | findstr &quot;:80&quot; | findstr &quot;LISTENING&quot;
TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       13056
TCP    [::]:80                [::]:0                 LISTENING       13056
TCP    [::1]:80               [::]:0                 LISTENING       16852
</code></pre>
<p>Once you note the PID listening on port 80, open up Task Manager using &quot;Ctrl+Alt+Delete&quot; and go to the Details tab. Sort by PID and find the process that you found listening to port 80. When I had the issue, the PID was 4.</p>
<p>Sometimes the process name is distinct, and other times it will just be called &quot;System&quot;. So regardless of the name, right click the name and click &quot;open file location&quot;.</p>
<p>If you are taken to &quot;ntoskrnl.exe&quot;, then the guilty culprit is most likely the &quot;World Wide Web Publishing Service&quot;. You can check this by typing &quot;Services&quot; in the Windows search bar, opening Services, and finding it on the list. If it is running, go ahead and stop it.</p>
<p>If that was not the case, there are other services/processes that can get in the way as well. The Stackoverflow <a href="https://stackoverflow.com/questions/1430141/port-80-is-being-used-by-system-pid-4-what-is-that">here</a> has a bunch of responses from other people with other processes sitting on port 80.</p>
<p>Once you have tackled that, apply your service again using:</p>
<pre><code>kubectl apply -f ingress-srv.yaml
</code></pre>
<p>and you should be good to go.</p>
