<p>After updating onprem kubernetes from 1.18 to 1.22.5, I had to switch the ingress api versions from <code>v1beta1</code> to <code>v1</code>, and selected <code>ImplementationSpecific</code> as the new, required <code>pathType</code>.</p>
<pre><code>kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  name: wx-ing-example
spec:
  rules:
    - host: &quot;*.example.com&quot;
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: wx-example
                port:
                  number: 80
</code></pre>
<p>Since the update, subdomains beyond one level aren't being sent to the service, and instead return a 404. I.e. bar.example.com is working, but foo.bar.example.com is not.</p>
<p>I've tried changing <code>pathType</code> to <code>Prefix</code> with no change in behaviour.</p>
<p><code>k8s.gcr.io/ingress-nginx/controller:v1.1.0</code></p>

Duncan Fairley
<p>What you are descibing is expected behavior according to the <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#hostname-wildcards" rel="nofollow noreferrer">official kubernetes ingress documentation</a>.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Host</th>
<th>Host header</th>
<th>Match?</th>
</tr>
</thead>
<tbody>
<tr>
<td>*.foo.com</td>
<td>bar.foo.com</td>
<td>Matches based on shared suffix</td>
</tr>
<tr>
<td>*.foo.com</td>
<td>baz.bar.foo.com</td>
<td>No match, wildcard only covers a single DNS label</td>
</tr>
<tr>
<td>*.foo.com</td>
<td>foo.com</td>
<td>No match, wildcard only covers a single DNS label</td>
</tr>
</tbody>
</table>
</div>
<p><code>PathType</code> has nothing to do with that. This is about the host header.</p>
<p>The only option I know of, is leaving the host completely away. So it will match any request that is able to find its way to your ingress controller. Depending on your situation, this may not be desirable.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: any-host
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: sample
            port:
              number: 80
</code></pre>
