In Traefik 1.7 I have the following labels for my bitwarden_rs container and I'd like to know how to properly translate the second frontend rule of it for traefik 2.0. I think I need a second router for that, but i'd like to get som verfification beforehand:
labels:
- traefik.web.frontend.rule=Host:service.domain.tld
- traefik.web.port=80
- traefik.hub.frontend.rule=Host:service.domain.tld;Path:/notifications/hub
- traefik.hub.port=3012
- traefik.http.routers.traefikweb.entrypoints=websecure
- traefik.http.routers.traefikweb.rule=Host(`service.domain.tld`)
- traefik.http.routers.traefikweb.tls=true
- traefik.http.routers.traefikweb.tls.certresolver=le
- traefik.http.routers.traefikhub.entrypoints=websecure
- traefik.http.routers.traefikhub.rule=(Host(`service.domain.tld`) && Path(`/notifications/hub`))
- traefik.http.routers.traefikhub.tls=true
- traefik.http.routers.traefikhub.tls.certresolver=le
Am I correct with my asumption?
Greetings
David
ldez
October 18, 2019, 2:55pm
2
Hello,
- traefik.http.routers.traefikweb.entrypoints=websecure
- traefik.http.routers.traefikweb.rule=Host(`service.domain.tld`)
- traefik.http.routers.traefikweb.tls=true
- traefik.http.routers.traefikweb.tls.certresolver=le
- traefik.http.routers.traefikweb.service=traefikweb
- traefik.http.services.traefikweb.loadbalancer.server.port=80
- traefik.http.routers.traefikhub.entrypoints=websecure
- traefik.http.routers.traefikhub.rule=(Host(`service.domain.tld`) && Path(`/notifications/hub`))
- traefik.http.routers.traefikhub.tls=true
- traefik.http.routers.traefikhub.tls.certresolver=le
- traefik.http.routers.traefikhub.service=traefikhub
- traefik.http.services.traefikhub.loadbalancer.server.port=3012
2 Likes
You're specifying the service (and port) too. Is there a reason for that, just like beeing explicit to avoid issues? For my other tests it seemed that I could skip both the service and port.
Greetings
David
ldez
October 18, 2019, 3:54pm
4
Basically, routers/services are like segment labels in v1.
When you define one or several routers with labels, Traefik create (and set on routers) automatically a service.
So if you want to use 2 different ports you have to explicitly create (and set on routers) the services.
Thank you. That worked perfectly.
Eoras
October 22, 2019, 7:49am
6
This work. THANK YOU
I was almost there, but I had a 404 error because I did not name my different services.