Kubernetes ingress for domain.com and www.domain.com

Hi guys,

Is there a way to create an ingress which works for domain.com and www.domain.com? right now I have to create two ingresses, one for each and I am pretty sure there has to be a way.


why do you prefer two ingress? just wondering.

I think @igarcia has to configure 2 ingresses right now and he’d prefer to configure a single one.

Technically you can use a single Ingress for the 2 hosts by using 2 rules in the ingress spec.
But :

  • I don’t know how traefik will react if you use traefik.ingress.kubernetes.io/redirect-regex and traefik.ingress.kubernetes.io/redirect-replacement on this ingress when it will match the rule for the redirected host.
  • I never tried such a configuration and I don’t know if it works well with the acme setup (if you are using it)

I am asking if it is possible to have just one ingress.

Ok thanks @cfurmaniak, I will try it.