Dynamic wildcard subdomain ingress for Kubernetes

here is an example:

 apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-wildcard-host
    spec:
      rules:
      - host: "foo.bar.com"
        http:
          paths:
          - pathType: Prefix
            path: "/bar"
            backend:
              service:
                name: service1
                port:
                  number: 80
      - host: "*.foo.com"
        http:
          paths:
          - pathType: Prefix
            path: "/foo"
            backend:
              service:
                name: service2
                port:
                  number: 80

and the source.


There certainly isn't anything like wildcard domains available in kubernetes, but you might be able to get want you want using Helm

With helm, you can template variables inside your manifests, so you can have the name of your branch be in the helm values file

From there, you can have gitlab-ci do the helm installation in a build pipeline and if you configure your chart correctly, you can specify a helm argument of the pipeline name.

There's a great blog post about this kind of workflow here - hopefully this'll get your where you need to go.