Documentation Index
Fetch the complete documentation index at: https://mintlify.com/traefik/traefik/llms.txt
Use this file to discover all available pages before exploring further.
Migration Guide: From v2 to v3
Migrate from Traefik Proxy v2 to v3 with confidence using this comprehensive guide that minimizes risk and ensures a smooth transition.Traefik v3 introduces minimal breaking changes and maintains backward compatibility with v2 syntax in dynamic configuration, offering a gradual migration path.
Overview
Traefik v3 streamlines the migration process from v2 by:- Introducing minimal breaking changes in static configuration
- Maintaining backward compatibility with v2 syntax in dynamic configuration
- Providing a gradual path for adopting v3 syntax
- Allowing progressive migration of Kubernetes resources, Docker labels, and other dynamic configurations
Migration Strategy
The migration consists of three progressive steps designed to minimize risk:Prepare and Test
Update static configurations, enable v2 compatibility mode, and thoroughly test in a non-production environment.
Deploy to Production
Progressively roll out Traefik v3 to production instances using a rolling update strategy.
Step 1: Prepare Configurations and Test v3
This step focuses on updating static configurations and enabling backward compatibility for safe testing.1.1 Review Static Configuration Changes
Review all breaking changes in static configuration that affect Traefik v3:Docker Provider Changes
In v3, Docker provider has been split into two separate providers: Before (v2):Removed Providers
The following providers have been removed in v3:- Rancher v1 Provider - Rancher v1 is no longer maintained. Use Kubernetes CRD provider for Rancher 2.x
- Marathon Provider - Marathon maintenance ended October 31, 2021
HTTP/3 Configuration
HTTP/3 is no longer experimental and theexperimental.http3 option has been removed.
Before (v2):
Namespace Options
Consul, ConsulCatalog, and Nomad providers now usenamespaces (plural) instead of namespace:
Before (v2):
TLS Configuration
Thetls.caOptional option has been removed from all providers (Docker, Consul, ConsulCatalog, Nomad, HTTP, ETCD, Redis).
Deprecated Features Removed
- InfluxDB v1 metrics provider (maintenance ended 2021)
- Traefik Pilot configuration (no longer available since October 2022)
1.2 Enable v2 Compatibility Mode
Add the following to your static configuration to maintain v2 syntax compatibility:This configuration makes v2 format the default for rule matchers syntax, allowing your existing dynamic configuration to work without modification.
1.3 Update Kubernetes Resources
If using Kubernetes providers, update your resources:Update CRDs
Update API Versions
- CRD API Group: Change from
traefik.containo.ustotraefik.io - Ingress API: Ensure you’re using
networking.k8s.io/v1(v1beta1 is removed) - CRD API Version: Use
apiextensions.k8s.io/v1(v1beta1 is removed)
1.4 Test in Non-Production Environment
Validation Checklist
- ✅ Traefik starts without error logs
- ✅ All routes are functioning correctly
- ✅ Applications are accessible through Traefik
- ✅ SSL/TLS termination works as expected
- ✅ Middleware behavior is unchanged
- ✅ Metrics and observability are working
Step 2: Migrate Production Instances to Traefik v3
This critical step migrates your production environment to Traefik v3.2.1 Pre-Migration Requirements
Before migrating production:2.2 Progressive Deployment Strategy
Use a progressive migration strategy to minimize risk:Kubernetes Rolling Update
Kubernetes Rolling Update
Docker Swarm Update
Docker Swarm Update
Blue-Green Deployment
Blue-Green Deployment
- Deploy v3 instances alongside v2 (green environment)
- Route a small percentage of traffic to v3
- Monitor metrics and error rates
- Gradually increase traffic to v3
- Decommission v2 instances once fully migrated
2.3 Monitor During Migration
Activate debug logging for detailed troubleshooting:- Request success rate (2xx/3xx responses)
- Error rate (4xx/5xx responses)
- Response time percentiles (p50, p95, p99)
- Active connections
- Backend health check status
2.4 Rollback Procedure
If issues arise, execute your rollback plan immediately:Kubernetes Rollback
Kubernetes Rollback
Docker Swarm Rollback
Docker Swarm Rollback
Step 3: Progressively Migrate Dynamic Configuration
This optional step migrates dynamic configuration from v2 to v3 syntax. It can be completed after production migration.This step is optional and can be done at your own pace. Traefik v3 remains compatible with v2 dynamic configuration syntax.
3.1 Understanding v3 Syntax Changes
Router Rule Matchers
Key changes in v3 syntax:| v2 Syntax | v3 Syntax | Notes |
|---|---|---|
Headers | Header | Singular form |
HeadersRegexp | HeaderRegexp | Singular form |
PathPrefix with regex | PathRegexp | PathPrefix no longer uses regex |
Path with {id} placeholders | PathRegexp | Placeholders no longer supported |
HostHeader | Host | HostHeader removed |
- v3 uses Go regexp syntax for all matchers
- All matchers take single values (except Header, HeaderRegexp, Query, QueryRegexp)
- Matchers must be explicitly combined using logical operators
3.2 Migration Examples
Example 1: Path Matcher Migration
Before (v2):Example 2: Path Placeholders to PathRegexp
Before (v2):Example 3: Headers to Header
Before (v2):Example 4: Complex PathPrefix Migration
Before (v2):3.3 Per-Router Migration Strategy
Migrate routers individually using theruleSyntax option:
Docker/Docker Swarm
Docker/Docker Swarm
Kubernetes IngressRoute
Kubernetes IngressRoute
File Provider (YAML)
File Provider (YAML)
File Provider (TOML)
File Provider (TOML)
3.4 Migration Process
3.5 Middleware Changes
Update middleware names if using deprecated options: IPWhiteList Renamed:sslRedirectsslTemporaryRedirectsslHostsslForceHostfeaturePolicy
- The
forceSlashoption has been removed
3.6 Final Cleanup
Once all routers are migrated to v3 syntax:Post-Migration Verification
After completing all migration steps, verify the deployment:Final Checklist
- ✅ All routers use v3 syntax
- ✅ v2 compatibility mode disabled
- ✅ No deprecated warnings in logs
- ✅ All applications functioning correctly
- ✅ Performance metrics stable or improved
- ✅ Observability (metrics, tracing, logs) working
- ✅ SSL/TLS certificates renewing correctly
- ✅ Health checks passing
- ✅ Middleware behaving as expected
Observability Changes
Be aware of these observability changes in v3: Metrics:- Open connections metric is now global:
traefik_open_connections(replaces per-entrypoint/router/service metrics) - gRPC status codes now use the
Grpc-Statusheader value
- Now powered exclusively by OpenTelemetry (OTLP)
- Direct vendor formats (Jaeger, Zipkin, Datadog, Elastic, etc.) are no longer supported
- Use OTLP ingestion endpoints or OpenTelemetry collectors
ServiceURLfield is now a string (not an object)- Update any log indexing that relies on this field
- Observability for internal routers/services is disabled by default
- Enable with
addInternalsoption in AccessLogs, Metrics, or Tracing
Common Issues and Solutions
Traefik Fails to Start After Upgrade
Traefik Fails to Start After Upgrade
Symptoms: Traefik exits immediately with configuration errorsSolutions:
- Check for deprecated static configuration options
- Verify
swarmModeis not used with Docker provider - Remove
experimental.http3option - Update namespace options to plural form
- Remove
tls.caOptionalfrom provider configurations
Routes Not Matching After Migration
Routes Not Matching After Migration
Symptoms: 404 errors for previously working routesSolutions:
- Ensure
core.defaultRuleSyntax: v2is set during migration - Check if PathPrefix rules need conversion to PathRegexp
- Verify path placeholders are converted to PathRegexp
- Update Headers/HeadersRegexp to Header/HeaderRegexp
Kubernetes Ingress Path Not Working
Kubernetes Ingress Path Not Working
Symptoms: Kubernetes Ingress paths with regex not matchingSolutions:
- Add annotation:
traefik.ingress.kubernetes.io/router.rulesyntax: v2 - Or convert regex to Go syntax and use PathRegexp matcher
- Or use
traefik.ingress.kubernetes.io/router.pathmatcherannotation
Metrics Not Appearing
Metrics Not Appearing
Symptoms: Missing metrics after upgradeSolutions:
- Update to new metric names (e.g.,
traefik_open_connections) - Enable internal resources with
addInternals: true - Remove references to removed metrics (config reload failures)
Tracing Not Working
Tracing Not Working
Symptoms: No traces appearing in tracing backendSolutions:
- Migrate to OpenTelemetry configuration
- Use OTLP-compatible endpoints
- Configure OpenTelemetry collector if needed
- Check OTLP exporter configuration
Additional Resources
- Traefik v3 Documentation
- v2 to v3 Detailed Changes
- Kubernetes CRD Provider
- OpenTelemetry Tracing
- Traefik Community Forum
Congratulations! You have successfully migrated to Traefik v3. Take advantage of new features like passive health checks, TCP health checks, and improved load balancing strategies.