Overview
Traefik's Many Friends
Configuration discovery in Traefik is achieved through Providers.
The providers are existing infrastructure components, whether orchestrators, container engines, cloud providers, or key-value stores. The idea is that Traefik will query the providers' API in order to find relevant information about routing, and each time Traefik detects a change, it dynamically updates the routes.
Deploy and forget is Traefik's credo.
Orchestrators
Even if each provider is different, we can categorize them in four groups:
- Label based (each deployed container has a set of labels attached to it)
- Key-Value based (each deployed container updates a key-value store with relevant information)
- Annotation based (a separate object, with annotations, defines the characteristics of the container)
- File based (the good old configuration file)
Supported Providers
Below is the list of the currently supported providers in Traefik.
Provider | Type | Configuration Type |
---|---|---|
Docker | Orchestrator | Label |
Kubernetes | Orchestrator | Custom Resource or Ingress |
Consul Catalog | Orchestrator | Label |
Marathon | Orchestrator | Label |
Rancher | Orchestrator | Label |
File | Manual | TOML/YAML format |
Consul | KV | KV |
etcd | KV | KV |
Redis | KV | KV |
ZooKeeper | KV | KV |
More Providers
The current version of Traefik doesn't support (yet) every provider. See the previous version (v1.7) for more providers.
Configuration reload frequency
In some cases, some providers might undergo a sudden burst of changes, which would generate a lot of configuration change events. If Traefik took them all into account, that would trigger a lot more configuration reloads than what is necessary, or even useful.
In order to mitigate that, the providers.providersThrottleDuration
option can be set. It is the duration that Traefik waits for, after a configuration reload, before taking into account any new configuration refresh event. If any event arrives during that duration, only the most recent one is taken into account, and all the previous others are dropped.
This option cannot be set per provider, but the throttling algorithm applies independently to each of them. It defaults to 2 seconds.
[providers]
providers.providersThrottleDuration = 10s
providers:
providersThrottleDuration: 10s
--providers.providersThrottleDuration=10s
Restrict the Scope of Service Discovery
By default Traefik will create routes for all detected containers.
If you want to limit the scope of Traefik's service discovery, i.e. disallow route creation for some containers, you can do so in two different ways: either with the generic configuration option exposedByDefault
, or with a finer granularity mechanism based on constraints.
exposedByDefault and traefik.enable
List of providers that support that feature:
Constraints
List of providers that support constraints: