<p>I installed pods and services with <code>deployment.yml</code>,<code>service.yml</code> and <code>ingress.yml</code> like this below.</p>
<p><code>deployment.yml</code></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: apa000dep
spec:
  selector:
    matchLabels:
      app: apa000kube
  replicas : 3
  template:
    metadata:
      labels:
        app: apa000kube
    spec:
      containers:
        - name: apa000ex91
          image: httpd
          ports:
          - containerPort: 80
      
</code></pre>
<p><code>service.yml</code></p>
<pre><code>apiVersion: v1
kind: Service
metadata: 
  name: apa000ser
spec:
  type: NodePort
  ports:
  - port: 8099
    targetPort: 80
    protocol: TCP
    nodePort: 30080
  selector:
    app: apa000kube
</code></pre>
<p>Both works well and, I can access pod directly <code>localhost:30080</code></p>
<p>then i installed ingress.</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
  - host: demo.localdev.me
    http:
      paths:
      - pathType: Prefix
        path: /*
        backend:
          service:
            name: apa000ser
            port:
              number: 8099
</code></pre>
<p>The hostname is set correctly</p>
<pre><code>$kubectl get ingress 
    
NAME              CLASS    HOSTS              ADDRESS   
PORTS   AGE
example-ingress   &lt;none&gt;   demo.localdev.me             80      95m
</code></pre>
<p>However when I access <code>http://demo.localdev.me</code> it returns 404 error.</p>
<p><code>http://localhost:30080/</code> returns <code>&lt;span&gt;it works!&lt;/span&gt;</code></p>
<p>So, I guess some ingress setting is wrong. where should I check?</p>
<hr />
<p>Even I stop <code>example-ingress</code>, result is same.</p>
<p>So it means.</p>
<pre><code>nginx-ingress -&gt; ingress -&gt; service -&gt; pods.
</code></pre>
<p>Every request is fetchd in first <code>nginx-ingress</code>, and not sent to <code>ingress</code>?</p>

<p>Two things that caught my eye:</p>
<ol>
<li><p>The Ingress controller you are using <del>seems to</del> might require an <code>ingressClassName</code> defined in the Ingress resource, so that the ingress controller takes this resource (and its configs) into account.</p>
<p>More about <code>Ingress class</code>:</p>
<ul>
<li><a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-class" rel="nofollow noreferrer">Ingress class</a></li>
<li><a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#default-ingress-class" rel="nofollow noreferrer">Default IngressClass</a></li>
</ul>
</li>
<li><p>You should change the <code>path: /*</code> to <code>path: /</code>.</p>
<ul>
<li><p><code>path: /*</code> makes the Ingress controller create a location block à la</p>
<pre><code>location /* {
  ...
}
</code></pre>
<p><code>/*</code> is interpreted as a normal prefix in this case and has nothing to do with regex (probably not what you assumed).</p>
<p>In your case: the <em>404</em> comes rather from the ingress itself (since request URI <code>/</code> not found - must be '/*' instead). In order for a request to be proxied to the httpd server at all, the request must be as follows: &quot;http://demo.localdev.me/*&quot;, to which the httpd would again respond with 404 (since the resource '/*' also doesn't exist on httpd by default).</p>
</li>
<li><p>Whereas <code>path: /</code> does the following:</p>
<pre><code>location / {
  ...
}
</code></pre>
<p>The <code>location /</code> block is a special case that matches any URI that starts with a slash (/), which includes all URIs. (This is also the default location block that Nginx uses if no other location block matches the request's URI.)</p>
</li>
</ul>
<p>More about nginx <code>location</code>:</p>
<ul>
<li><a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#location" rel="nofollow noreferrer">nginx doc</a></li>
<li><a href="https://stackoverflow.com/questions/59846238/guide-on-how-to-use-regex-in-nginx-location-block-section">Guide on how to use regex in Nginx location block section?</a></li>
</ul>
</li>
</ol>
<p><strong>Final result:</strong></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  ingressClassName: nginx   # add
  rules:
  - host: demo.localdev.me
    http:
      paths:
      - pathType: Prefix
        path: /           # change
        backend:
          service:
            name: apa000ser
            port:
              number: 8099
</code></pre>
