Traefik
Application Proxy.
Migrated to ansible collection
Tip
- All defined routes are required to have a router, optionally middleware, and a backend service.
- Using @file instructs Traefik to locate router/middleware/service definitions in local files.
- Items defined in web and webs are applied globally to all routers that use that entrypoint. Middleware is layered with additional router definitions.
- Examples use separate dynamic configuration files but it may be more beneficial in complex configurations to group definitions together by functionality (e.g. dynamic/media.yml or dynamic/hypervisor.yml).
Concepts
Install Configuration (traefik.yml)
Contains all parameters that require a restart of Traefik. This is typically stored in traefik.yml.
Routing Configuration (dynamic)
Contains all parameters that do not require a service restart and are reloaded on file changes. This is typically stored in a dynamic directory.
Examples here use file providers for non-docker/kubernetes installs. There are plenty of non-file examples.
Routers
Define how incoming connections through entrypoints are directed to backend services, optionally applying middleware as well as connection requirements.
Middleware
Note
Traefik uses middlewares in configuration but middleware in documentation.
Manipulates incoming connection requests before sending to the backend service or before responding to the client. UDP does not have middleware - Traefik does maintain state to response to the correct clients - backend services must manage this themselves.
Middleware chained together using effectively grouping middleware in a group to apply consistently across many routers.
Service
Defines how incoming connections are distributed to backend services. All services are load-balanced, even if there is only one backend.