Skip to main content

etcd Provider

A Story of KV Store & Containers Store your Traefik configuration in etcd and let Traefik automatically watch for changes. The etcd provider enables centralized configuration management with distributed consistency and high availability.

Why Use etcd?

✅ Centralized configuration - Single source of truth for all Traefik instances
✅ High availability - Distributed key-value store with strong consistency
✅ Real-time updates - Traefik watches for changes and updates instantly
✅ Multi-instance support - Share configuration across multiple Traefik replicas
✅ Version control - Track configuration changes over time

Quick Start

1

Enable etcd Provider

2

Store Configuration in etcd

3

Configuration Auto-Loads

Traefik automatically detects changes and updates routing!

Configuration Structure

The etcd provider uses a hierarchical key structure:

Provider Configuration

endpoints

Required, Default: ["127.0.0.1:2379"] etcd server addresses:

rootKey

Default: traefik Root prefix for all configuration keys:
Keys will be stored under /myapp/lb/http/routers/...

username

Optional, Default: "" Authentication username:

password

Optional, Default: "" Authentication password:
Store passwords in environment variables, not in configuration files.

tls

TLS configuration for secure connections:

Configuration Examples

HTTP Router and Service

Middleware

Attach to router:

TCP Router and Service

TLS Configuration

Complete Application Example

Management Scripts

Backup Configuration

Restore Configuration

List All Routes

High Availability Setup

All Traefik instances share the same configuration from etcd cluster.

Key Management Best Practices

1

Use Consistent Naming

Develop a naming convention:
2

Organize by Environment

3

Version Critical Changes

Keep backups before major changes:
4

Use TTL for Temporary Routes

Set lease for temporary configurations:

Troubleshooting

Connection Issues

1

Test etcd Connection

2

Check Authentication

3

Verify TLS Configuration

Configuration Not Loading

Watch Not Working

Ensure Traefik has watch permissions:

Monitoring

Watch Configuration Changes

Configuration Metrics

Migration from File Provider

Convert file configuration to etcd:

Next Steps

KV Provider Routing

Detailed routing configuration for KV stores

etcd Documentation

Official etcd documentation