Hi folks, I am new to Traefik and use it to route my OpenShift URLs.
My question is, how to configure Traefik, so that I do not need to add subdomains in my configs anymore, if a new application was deployed.
Here is my config:
/etc/traefik/traefik.toml
[log]
level = "DEBUG"
[accessLog]
[entryPoints]
[entryPoints.api]
address = ":6443"
[entryPoints.https]
address = ":443"
[providers]
[providers.file]
directory = "/etc/traefik/conf.d"
watch = true
/etc/traefik/conf.d/exp-ocp.toml
[tcp.routers]
[tcp.routers.exp-ocp4-api]
entryPoints = ["api"] #entry points are shared among the clusters
rule = "HostSNI(\`api.exp-ocp4.mycloud.io.cpak\`)"
service = "service-exp-ocp4-api"
[tcp.routers.exp-ocp4-api.tls]
passthrough = true
[tcp.routers.exp-ocp4-https]
entryPoints = ["https"]
rule = "HostSNI(\`oauth-openshift.apps.exp-ocp4.mycloud.io.cpak\`,\`console-openshift-console.apps.exp-ocp4.mycloud.io.cpak\`,\`prometheus-k8s-openshift-monitoring.apps.exp-ocp4.mycloud.io.cpak\`,\`grafana-openshift-monitoring.apps.exp-ocp4.mycloud.io.cpak\`,\`alertmanager-main-openshift-monitoring.apps.exp-ocp4.mycloud.io.cpak\`,\`thanos-querier-openshift-monitoring.apps.exp-ocp4.mycloud.io.cpak\`,\`grafana-grafana.apps.exp-ocp4.mycloud.io.cpak\`,\`sso-sso.apps.exp-ocp4.mycloud.io.cpak\`)"
service = "service-exp-ocp4-https"
[tcp.routers.exp-ocp4-https.tls]
passthrough = true
[tcp.services]
[tcp.services.service-exp-ocp4-api.loadBalancer]
[[tcp.services.service-exp-ocp4-api.loadBalancer.servers]]
address = "#LOADBALANCER_IP#:6443"
[tcp.services.service-exp-ocp4-https.loadBalancer]
[[tcp.services.service-exp-ocp4-https.loadBalancer.servers]]
address = "#LOADBALANCER_IP#:443"
My goal is to reduce the 'rule' statement in [tcp.routers.exp-ocp4-https] just to
rule = "HostSNI(\`*.apps.exp-ocp4.mycloud.io.cpak\`)"
but it seems a little bit tricky.
Is this possible with Traefik 1.x ?
How the config would looks like in Traefik 2.x ?
Many thanks so far.
Cheers.