Can traefik config (backends, routers) be updated at runtime?


is it possible (or planned) to update the traefik config at runtime without having to restart the process? I'd like to add a new backend and a corresponding router via rest request to /api. I looked into the docs and didn't found anything, I just want to make sure I'm not missing anything here.

I'm looking for sth. like this:

POST https://traefik/api/backends
"name": "new_backend_1",
"ip": ""

POST https://traefik/api/routers
"path": "/1"
"name": "new_backend_router_1",
"backend": "new_backend_1"

Traefik uses „dynamic configuration“ for routers and services, so this can be changed on the fly. The static configuration contains for example entrypoints (ports), those are fixed.

This is how provider.docker sets up new routers and services from Docker service/container labels. You can easily add new domains/paths or scale up and down.

The configuration can’t be POSTed to Traefik, instead you have to provide it as configuration. You can use a config file via provider.file or use another provider. Or create your own provider plugin.

So, if I understand correctly, a custom provider would contain logic to pull backend and router data out of some kind of registry, webservice, file, etc. which (the registry) I would have to update then. Also the provider would contain the logic to create the config objects in traefik.

Does that sound right?

Whatever logic you have to create a new router (domain/path) or service (loadbalancer target url), it should be translated into a dynamic Traefik configuration.

That configuration you can save as file (which Traefik can watch with provider.file) or serve through other means (http server, redis, consul).

Crazy example: script to use Traefik API to get routers and create certificates, those are served as Traefik dynamic config via http server.

Alternatively you implement that as own provider plugin, but that needs to be in go.