4.1 KiB
Traefik Sablier Plugin
The Traefik Sablier Plugin in the plugin catalog.
Provider compatibility grid
| Provider | Dynamic | Blocking |
|---|---|---|
| Docker | ✅ | ✅ |
| Docker Swarm | ✅ | ✅ |
| Kubernetes | ✅ | ❌ #62 |
Prerequisites
Docker
Traefik will evict containers from its pool if they are stopped.
Meaning labels attached to containers to autodiscover them is not possible with this plugin.
You have to use the dynamic config file provider instead.
❌ You cannot do the following:
whoami:
image: containous/whoami:v1.5.0
labels:
- traefik.enable
- traefik.http.routers.whoami.rule=PathPrefix(`/whoami`)
- traefik.http.routers.whoami.middlewares=my-sablier@file
✅ You should do the following instead:
http:
services:
whoami:
loadBalancer:
servers:
- url: "http://whoami:80"
routers:
whoami:
rule: PathPrefix(`/whoami`)
entryPoints:
- "http"
middlewares:
- my-sablier@file
service: "whoami"
dynamic-config.yaml
Docker Swarm
Traefik will evict services from its pool if they have 0 replicas.
In order to use service labels, you have to add the following option on top of each services that will use this plugin.
See also traefik.docker.lbswarm label
services:
whoami:
image: containous/whoami:v1.5.0
deploy:
replicas: 0
labels:
- traefik.docker.lbswarm=true
Traefik also have allowEmptyServices option which can be used instead.
But the blocking strategy won't work for the same reasons described in #62.
Kubernetes
Traefik will evict deployments from its pool if they have 0 endpoints available.
You must use allowEmptyServices
The blocking strategy is not supported because everytime the underlying configuration changes, the whole router is regenrated, thus changing the router during a request will still map to the old router. For more details, see #62.
Install the plugin to Traefik
File (YAML)
experimental:
plugins:
sablier:
moduleName: "github.com/acouvreur/sablier"
version: "v1.7.1-beta.1"
CLI
--experimental.plugins.sablier.modulename=github.com/acouvreur/sablier
--experimental.plugins.sablier.version=v1.7.1-beta.1
Configure the plugin using the Dynamic Configuration
File (YAML)
http:
middlewares:
my-sablier:
plugin:
sablier:
group: default
dynamic:
displayName: My Title
refreshFrequency: 5s
showDetails: "true"
theme: hacker-terminal
sablierUrl: http://sablier:10000
sessionDuration: 1m
Kubernetes CRD
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: my-sablier
namespace: my-namespace
spec:
plugin:
sablier:
group: default
dynamic:
displayName: My Title
refreshFrequency: 5s
showDetails: "true"
theme: hacker-terminal
sablierUrl: http://sablier:10000
sessionDuration: 1m
Configuration reference
TODO