<p>I am taking a course in Udemy and I am new to the world of <strong>Kubernetes</strong> and I am trying to configure <strong>ingress nginx controller</strong> in Kubernetes but it returns <strong>404 not found</strong> when i send a request at specified URL, it has been 10 days that I am trying to fix it, i've looked at similar questions but none of their answers are working for me. I am also using <strong>Skaffold</strong> to do build/deploy image on docker hub automatically when i change something in files.</p>
<p><a href="https://i.stack.imgur.com/U0WyJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U0WyJ.png" alt="404 not found screenshot" /></a></p>
<p>My <strong>express app</strong> server:</p>
<pre><code>app.get('/api/users/currentuser', (req, res) =&gt; {
  res.send('Hi there');
});

app.listen(3000, () =&gt; {
  console.log('[Auth] - Listening on port 3000');
});
</code></pre>
<p><strong>ingress-srv.yaml</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'
spec:
  rules:
    - host: ticketing.com
      http:
        paths:
          - path: /api/users/?(.*)
            pathType: Prefix
            backend:
              service:
                name: auth-srv
                port:
                  number: 3000
</code></pre>
<p><strong>auth-depl.yaml</strong> (Auth deployment &amp; srv)</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: auth
  template:
    metadata:
      labels:
        app: auth
    spec:
      containers:
        - name: auth
          image: myusername/auth:latest
---
apiVersion: v1
kind: Service
metadata:
  name: auth-srv
spec:
  type: ClusterIP
  selector:
    app: auth
  ports:
    - name: auth
      protocol: TCP
      port: 3000
      targetPort: 3000
</code></pre>
<p><strong>skaffold.yaml</strong> file:</p>
<pre><code>apiVersion: skaffold/v2beta25
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: username/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
</code></pre>
<p><strong>Dockerfile</strong>:</p>
<pre><code>FROM node:alpine

WORKDIR /app
COPY package.json .
RUN npm install
COPY . . 

CMD [&quot;npm&quot;, &quot;start&quot;]
</code></pre>
<p>I also executed command from <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">NGINX Ingress Controller docs</a>:</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.5/deploy/static/provider/cloud/deploy.yaml
</code></pre>
<p>I also changed hosts.file in the system:
127.0.0.1 ticketing.com</p>
<p>Logs:</p>
<p><strong>kubectl get pods</strong></p>
<pre><code>NAME                         READY   STATUS    RESTARTS   AGE
auth-depl-5f89899d9f-wtc94   1/1     Running   0          6h33m
</code></pre>
<p><strong>kubectl get svc</strong></p>
<pre><code>NAME         TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE
auth-srv     ClusterIP   10.96.23.71   &lt;none&gt;        3000/TCP   23h
kubernetes   ClusterIP   10.96.0.1     &lt;none&gt;        443/TCP    25h
</code></pre>
<p><strong>kubectl get pods --namespace=ingress-nginx</strong></p>
<pre><code>NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx-admission-create-7fm56        0/1     Completed   0          23h
ingress-nginx-admission-patch-5vflr         0/1     Completed   1          23h
ingress-nginx-controller-5c8d66c76d-89zhp   1/1     Running     0          23h
</code></pre>
<p><strong>kubectl get ing</strong></p>
<pre><code>NAME          CLASS    HOSTS           ADDRESS     PORTS   AGE
ingress-srv   &lt;none&gt;   ticketing.com   localhost   80      23h
</code></pre>
<p><strong>kubectl describe ing ingress-srv</strong></p>
<pre><code>Name:             ingress-srv
Namespace:        default
Address:          localhost
Default backend:  default-http-backend:80 (&lt;error: endpoints &quot;default-http-backend&quot; not found&gt;)
Rules:
  Host           Path  Backends
  ----           ----  --------
  ticketing.com
                 /api/users/?(.*)   auth-srv:3000 (10.1.0.10:3000)
Annotations:     kubernetes.io/ingress.class: nginx
                 nginx.ingress.kubernetes.io/use-regex: true
Events:
  Type    Reason  Age                 From                      Message
  ----    ------  ----                ----                      -------
  Normal  Sync    22m (x18 over 23h)  nginx-ingress-controller  Scheduled for sync
</code></pre>
<p>Could there be a problem with the Windows IIS web server? since I previously configured something for another project, and in the screenshot above I see:</p>
<pre><code>Requested URL      http://ticketing.com:80/api/users/currentuser
Physical Path      C:\inetpub\wwwroot\api\users\currentuser
</code></pre>
<p>Also the screenshot shows the port <strong>:80</strong> at the requested URL but I have the server port 3000? + when i request at <strong>https</strong> it returns:</p>
<pre><code>502 Bad Gateway
nginx
</code></pre>
<p>also C:\inetpub\wwwroot is strange to me.</p>
<p>Any ideas would help me a lot with continuing the course.</p>

sycamore55
<p>After a few days of research I finally solved the problem, the problem was with IIS Web Server which I had enabled when I was working on a project in ASP.NET core, I uninstalled it and the problem was solved.</p>
<p>How to uninstall IIS from Windows 10:</p>
<ul>
<li>Go to Control Panel &gt; Programs and Features</li>
<li>Click Turn Windows features on or off</li>
<li>Scroll down to Internet Information Services</li>
<li>Click on the square next to Internet Information Services so it becomes empty</li>
<li>Click OK and restart the PC (required).</li>
</ul>
