hi all,
i was reading up on the built-in traefik nomad service discovery mechanism – and was wondering if it is possible (or any future plans) to have any kind of weighted load-balancing across multiple services …
for example, it would be nice to either declare multiple nomad services for a router rule for even-split routing (see example below) – or even better, to declare a weighted traefik service (using nomad service tags) that can distribute traffic to multiple nomad services …
yes – i am aware i could just manage the traefik config file myself (and may end up doing that), but was hoping there would either be a work-around using the built-in traefik nomad service discovery OR maybe it is on the road-map ??
side note :: best i can tell, even the built-in traefik consul service discovery mechanism doesn’t offer weighted load-balancing ??
it is very possible i am overthinking this and should just rely on the nomad update
configuration to roll out canary deployments, which would have at least some kind of weighted distribution before i choose to promote the new deployment …
anyway – your input is appreciated …
thanks !!
## even-split ##
# now .. all traffic goes to 1 service
traefik.http.routers.myrouter.rule=Host(`myservice.example.com`)
traefik.http.routers.myrouter.service=myservice
# desired .. traffic goes to multiple services
traefik.http.routers.myrouter.rule=Host(`myservice.example.com`)
traefik.http.routers.myrouter.services=myblueservice, mygreenservice
# ^^ 50% to myblueservice, 50% to mygreenservice
annoucement
nomad complete configs reference
traefik nomad routing configs
built-in traefik consul service discovery
Hi @gkspranger,
Nomad currently is only responsible for providing the service catalog to Traefik.
I am aware i could just manage the traefik config file myself
To clarify for myself and other readers, I assume this relates to configuring something like weighted round-robin by using a template block to dynamically generate the configuration file for your Traefik job?
declare a weighted traefik service (using nomad service tags) that can distribute traffic to multiple nomad services
I am mildly familiar with Traefik’s internals but is this possible and done with other Traefik catalog providers? If so, that does sound very interesting and something we would love to be able to write, however, I am not aware of any plans currently on the Nomad team to extend the Nomad Traefik catalog.
Thanks,
jrasell and the Nomad team

apologies in advance for any vagueness around my question and thank you for replying …
yes – exactly correct …
not that i am aware of (at least in an obvious way) – as best i can tell, mainly reviewing the consul, nomad, and docker providers …
i am aware that Nomad is only responsible for providing the service catalog to Traefik – i guess i was hoping maybe somebody in the forum had figured out a way to achieve round-robin (weighted preferred) across multiple Nomad services …
all that said – i am pretty sure i am overthinking this and relying on Traefik to achieve what is essentially a blue/green deployment – and as you are aware, Nomad has the perfectly capable update stanza to achieve this …
just to add a little more backstory to my question, we are continually running a blue and green version of our app … most of the time they are different app versions (we deploy constantly), but sometimes they are the same – like just after a successful blue app deploy and before the next green app deploy is queued … anyway – we allow access to our green app if a specific Cookie value is present (mainly for testing) – otherwise, all traffic will be routed to the blue app …
as i am writing this, it now makes more sense to lean on that update { canary = # }
stanza in the blue app to achieve “round-robin” across multiple app versions – otherwise, i would be re-deploying the blue app just to update the Traefik routing tags … i can also refine the canary count to achieve my desired “weight” – at least before promoting the deployment …
ok – i think you can ignore me now … thanks for listening …
# condensed examples of our service tags
# our blue app service tags
tags = [
"traefik.http.routers.blueapp.rule=Host(`blueapp.example.com`)",
"traefik.http.routers.app-current.rule=Host(`app.example.com`)",
"traefik.http.routers.app-current.service=blueapp",
]
# our green app service tags
tags = [
"traefik.http.routers.greenapp.rule=Host(`greenapp.example.com`)",
"traefik.http.routers.app-future.rule=Host(`app.example.com`) && Headers(`Cookie`, `future=true`)",
"traefik.http.routers.app-future.service=greenapp",
]