Skip to main content

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
Dynamic Configuration (discovered from providers):
  • Routers
  • Services
  • Middlewares
  • TLS certificates

File Provider

Define configuration in YAML or TOML files:

Basic Configuration

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

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:

IngressRoute Example

Kubernetes Ingress Provider

Use standard Kubernetes Ingress resources:

Ingress Example

HTTP Provider

Fetch configuration from HTTP endpoint:
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:

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

  • Set exposedByDefault: false for Docker provider
  • Use network isolation between Traefik and services
  • Restrict provider API access with minimal permissions
  • Validate configuration before applying
  • Use providersThrottleDuration to avoid excessive reloads
  • Filter namespaces in Kubernetes providers
  • Use constraints to limit scope of service discovery
  • Enable watch mode for real-time updates
  • Always define health checks for services
  • Use multiple providers for redundancy
  • Set appropriate timeouts for provider connections
  • Monitor provider connection status

Complete Example