Search code examples
kuberneteskubernetes-ingressnginx-ingress

Wildcard to match `path` and `serviceName` in Kubernetes ingress


I have a Kubernetes cluster with an undefined series of services, and what I want to do is serve each service on an endpoint, with the ability to add new services at any time, with them still being available at an endpoint.

I'm looking for a way to set, in my ingress, a wildcard on serviceName, so that /xx will be routed to service xx, /yy to service yy, etc. Another solution that I could also use would be matching http://xx.myurl.com to service xx.

Is this something doable with Kubernetes?

I imagine something of the like

- path: /(.*)
  backend:
    serviceName: $1
    servicePort: 80

Thanks,

Colin


Solution

  • This is not something the Ingress system supports. Some other tools may, you can do this pretty easily with a static Nginx config for example.