Providers
Automatic Configuration Discovery Providers are infrastructure components that Traefik queries to discover services and routing configuration. They enable dynamic configuration updates without manual intervention.Provider Types
Traefik supports four types of providers:Orchestrators
Docker, Kubernetes, Nomad, ECS - Discover services from container platforms
Key-Value Stores
Consul, Etcd, Redis, ZooKeeper - Store configuration in distributed KV stores
File-Based
YAML/TOML files - Define configuration manually in files
Service Discovery
Consul Catalog, Nomad - Discover services from service catalogs
Static vs Dynamic Configuration
Static Configuration (defined at startup):- Which providers to enable
- Provider connection details
- Provider-specific settings
- Routers
- Services
- Middlewares
- TLS certificates
File Provider
Define configuration in YAML or TOML files:Basic Configuration
- YAML
- TOML
- CLI
string
Directory containing dynamic configuration files
string
Single file containing dynamic configuration (alternative to directory)
boolean
default:"true"
Automatically reload when files change
Example Dynamic Configuration File
Docker Provider
Automatically discover services from Docker containers:Basic Configuration
- YAML
- TOML
- CLI
string
default:"unix:///var/run/docker.sock"
Docker daemon socket or TCP endpoint
boolean
default:"true"
Automatically expose all containers (set to
false for production)string
Docker network to use for connections
boolean
default:"true"
Watch for Docker events to update configuration
Container Labels
Configure routing using Docker labels:Kubernetes Providers
Kubernetes CRD Provider
Use Traefik’s Custom Resource Definitions:- YAML
- TOML
IngressRoute Example
Kubernetes Ingress Provider
Use standard Kubernetes Ingress resources:- YAML
- TOML
Ingress Example
HTTP Provider
Fetch configuration from HTTP endpoint:- YAML
- TOML
string
required
HTTP endpoint returning JSON configuration
duration
default:"5s"
How often to poll for configuration updates
Multiple Providers
You can enable multiple providers simultaneously:- YAML
- TOML
Provider Namespaces
When referencing resources across providers, use the@provider syntax:
The provider name is appended with
@ to reference cross-provider resources.Provider Reference
Best Practices
Security
Security
- Set
exposedByDefault: falsefor Docker provider - Use network isolation between Traefik and services
- Restrict provider API access with minimal permissions
- Validate configuration before applying
Performance
Performance
- Use
providersThrottleDurationto avoid excessive reloads - Filter namespaces in Kubernetes providers
- Use constraints to limit scope of service discovery
- Enable
watchmode for real-time updates
Reliability
Reliability
- Always define health checks for services
- Use multiple providers for redundancy
- Set appropriate timeouts for provider connections
- Monitor provider connection status
Complete Example
- YAML
- TOML