traefik / traefik
Traefik turns service discovery into routing, which makes metadata part of the edge
The proxy watches Docker, Kubernetes, files, and other providers, then hot-reloads routers, middlewares, and services. That responsiveness is valuable only when teams control who may publish the metadata it trusts.
WHAT TO KNOW FIRST
- Traefik separates install configuration from hot-reloaded routing configuration. Entry points and providers boot the proxy; routers, middlewares, and services describe request handling.
- Provider metadata is a control-plane input. Docker labels or Kubernetes resources can expose services and attach policy, so write access to them is security-sensitive.
- The repository is the MIT-licensed Traefik Proxy. Traefik Hub API Gateway and API Management add commercial capabilities under separate terms.
01The core idea is routing from changing infrastructure
Traefik Proxy is an application proxy and ingress controller written in Go. It can discover routing configuration from providers such as Docker, Kubernetes, and files, then update active routes as services change. This avoids generating and restarting a static proxy for every container event. The same process can handle HTTP, TCP, and UDP routing according to the enabled features and configuration.
Discovery is not intent by itself. A running container should not automatically become public merely because it has a port. Teams decide which objects may be exposed, which domain and path they own, and which middleware chain applies. Provider defaults and constraints should make the safe state quiet. The proxy is most useful when platform rules turn workload metadata into a reviewed contract, not when any deployment can improvise at the internet boundary.
02Install and routing configuration change at different speeds
Current Traefik documentation distinguishes install configuration, formerly called static configuration, from routing configuration, formerly called dynamic configuration. Install settings define entry points, providers, API and dashboard options, logs, and other boot-time behavior that requires restart when changed. A configuration file, command-line arguments, or environment variables can provide this layer, and the documentation says these methods are mutually exclusive, so only one can be used at a time.
Routing configuration contains routers, services, middlewares, and TLS-related resources that providers can update without restarting request handling. Keeping the layers separate helps explain why adding a route works immediately but adding a new listening port does not. Store both layers in version control where possible, name the responsible provider, and test a full restart as well as a hot update. A system that only survives dynamic reload has not proved its boot configuration is reproducible.
03Entry points, routers, middlewares, and services form the path
An entry point is a listening address. A router evaluates rules, such as host and path conditions, for requests on selected entry points. Matching traffic passes through attached middlewares and reaches a service, whose load balancer names upstream servers or another service composition. TLS settings can make the router handle secure traffic and use a certificate resolver. Provider namespaces distinguish resources with the same name from different sources.
This vocabulary makes request handling inspectable, but precedence must be explicit. Overlapping rules use priorities, middleware order changes behavior, and a router that references the wrong provider-qualified name may lose intended policy. Draw one request from socket to upstream and include redirects, authentication, headers, rate limits, and error handling. Keep shared middleware in a controlled provider, then reference it deliberately. An implied global security layer is easy to bypass when a new router omits one label.
- Use explicit entry points and router priorities for overlapping rules.
- Qualify cross-provider resource names and keep shared policy centrally owned.
- Test middleware order with actual redirects, auth failures, and forwarded headers.
04Providers convert platform permissions into edge permissions
A provider watches an infrastructure API or configuration source and turns supported metadata into Traefik objects. The Docker provider commonly reads labels, while Kubernetes providers read resources such as Ingress, custom resources, or Gateway API objects according to configuration. The file provider declares objects directly and is useful for shared middleware or services outside an orchestrator.
Provider credentials can reveal service topology and may enable broad control-plane reads. Metadata writers can potentially create public routes, weaken middleware, or point traffic at sensitive targets. Scope credentials and resource access, use provider constraints or namespaces, and disable automatic exposure when the environment supports it. In Kubernetes, admission and RBAC policy should define who may create relevant routing resources. In Docker, access to the engine socket is highly privileged and should not be handed to arbitrary containers as a convenience.
05TLS automation still has shared-state consequences
Certificate resolvers can automate ACME issuance through supported challenge types. Routers select the resolver and domains through their rules or TLS configuration. The proxy needs reachable challenge paths or DNS credentials, and it must store account and certificate state with restrictive permissions. Issuer rate limits and DNS propagation are external constraints that a valid configuration cannot remove.
A single instance and a horizontally scaled edge have different coordination needs. Several independent proxies should not all race to manage the same certificates through casually shared files. Current commercial Traefik products advertise distributed certificate capabilities beyond the open-source proxy, so confirm what the selected edition supports. Alternatively terminate TLS at another owned layer. In every design, alert before expiry, preserve state across ordinary redeployments, and test a new certificate without consuming production issuance limits unnecessarily.
06Middleware is policy code in the request path
HTTP middlewares can redirect, alter paths and headers, apply authentication, limit requests, retry, compress, or perform other documented transformations. They can be chained and attached to routers, and current versions also support service-level middleware in documented providers. This is a practical place for consistent edge behavior when the policy truly belongs before every selected backend.
Middleware cannot infer application semantics. Retrying a non-idempotent request may duplicate work. A header middleware can overwrite information the application expected to validate. Rate limiting on one process may not create a global limit across replicas. Authentication options and distributed behavior differ between Proxy and commercial products. Document whether each control is local or shared, keep business authorization in the application, and test bypass paths. Edge policy should reduce exposure, not become the only place a sensitive operation is protected.
07The dashboard helps operators and attracts attackers
Traefik's API and dashboard expose active routers, services, middlewares, provider errors, and other operational information. They are useful when a route exists in source metadata but not in the running proxy. The convenient insecure mode is suitable only for tightly bounded experiments. A production dashboard should be routed through an authenticated and encrypted path, restricted by network policy, or disabled when it has no owner.
The dashboard is also not the whole observability program. Access logs, application logs, metrics, and traces can connect a client request to a route and upstream, while health and provider error signals show control-plane failures. Avoid labels with secrets because infrastructure metadata and dashboards may expose them. Protect telemetry endpoints, sample and retain traffic data intentionally, and separate a backend's 500 response from a proxy-generated failure. The distinction determines whether an incident belongs to routing or application owners.
08High availability requires more than another replica
Multiple Traefik instances can reduce process and node failure risk when an external load balancer or orchestrator distributes traffic. Each instance must receive coherent routing configuration, trust the same identity boundaries, and have a supported certificate strategy. Provider watch delays, rolling upgrades, and connection draining create periods where instances may not be identical. Test deletion and rollback as carefully as route creation.
Set CPU and memory limits from traffic tests, define timeouts for clients and upstreams, and understand long-lived WebSocket or gRPC connections during shutdown. Monitor configuration reload failures, provider connectivity, route counts, open connections, upstream health, latency, status codes, and certificate state. Back up source configuration rather than assuming the runtime dashboard is a recoverable store. A proxy that is alive but has dropped its provider connection can preserve stale routes while silently missing the next service change.
09Major versions and product editions need clean names
Traefik has made substantial configuration changes across major versions, and official migration guides document removed, renamed, and changed behavior. Pin a major and minor release, read the matching documentation rather than a search result for an older line, and rehearse migration with every provider and middleware used. Configuration acceptance is only the first check; compare active routes and exercise representative requests before completing rollout.
The traefik/traefik repository is Traefik Proxy under the permissive MIT license. Traefik Labs currently presents Traefik Hub API Gateway and Traefik Hub API Management as products layered beyond the open-source proxy, with commercial security, distributed coordination, and management capabilities. Plugins and dependencies also have separate licenses. Name the evaluated artifact and edition in architecture records so an open-source feature list is not accidentally filled with capabilities available only under another product's terms.
A SENSIBLE FIRST HOUR
Start small enough to learn the repo
- Run a pinned Traefik Proxy release with the file provider, one entry point, one router, and one service before connecting it to a container or cluster control plane.
- Add one middleware and a second route, then inspect the dashboard through a secured router to confirm which provider created each active object.
- Configure a certificate resolver for a controlled hostname, persist its storage with restrictive permissions, and test renewal-related access plus an unavailable backend.
- Before production, disable exposure by default where supported, restrict provider credentials, secure API and dashboard access, validate configuration, and rehearse a documented major-version migration.
SOURCE LEDGER
What this review is built on
We use the project repository and first-party documentation. Access, licenses and project direction can change, so recheck the linked source before making a production decision.