<p>I am trying to understand if I can specify a wildcard domain in the kubernetes ingress configuration.
I am running AWS Eks cluster.
I have a web pages, where url is structured as client.example.com but for the invite and login app I need to redirect traffic to related invite/login services. All other traffic should normally go to the main-service.</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: -ingress
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip


spec:
  rules:
  - host: &quot;*.example.com&quot;
    http:
      paths:
      - backend:
          service:
            name: main-service
            port:
              number: 80
        path: /*
        pathType: ImplementationSpecific
  - host: login.example.com
    http:
      paths:
      - backend:
          service:
            name: login-service
            port:
              number: 80
        path: /*
        pathType: ImplementationSpecific
  - host: invite.example.com
    http:
      paths:
      - backend:
          service:
            name: invite-service
            port:
              number: 80
        path: /*
        pathType: ImplementationSpecific
</code></pre>
<p>Is it possible to create such a configuration within Kubernetes ingress?</p>
<p>Thanks</p>

rholdberh
<p>Wildcard hostname is officially  supported starting in 1.18:</p>
<p>&quot;Many Ingress providers have supported wildcard hostname matching like <em>.foo.com matching app1.foo.com, but until now the spec assumed an exact FQDN match of the host. Hosts can now be precise matches (for example “foo.bar.com”) or a wildcard (for example “</em>.foo.com”). Precise matches require that the http host header matches the Host setting. Wildcard matches require the http host header is equal to the suffix of the wildcard rule.&quot;</p>
<p><a href="https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#support-for-hostname-wildcards" rel="nofollow noreferrer">https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#support-for-hostname-wildcards</a></p>
