clarify automatic service creation/assignment with labels
This commit is contained in:
parent
c8fa059064
commit
c6e783e7c3
6 changed files with 156 additions and 5 deletions
|
@ -17,7 +17,7 @@ Attach labels to your services and let Traefik do the rest!
|
|||
!!! info "Labels"
|
||||
|
||||
- Labels are case insensitive.
|
||||
- The complete list of labels can be found [the reference page](../../reference/dynamic-configuration/rancher.md)
|
||||
- The complete list of labels can be found in [the reference page](../../reference/dynamic-configuration/rancher.md).
|
||||
|
||||
### General
|
||||
|
||||
|
@ -25,6 +25,32 @@ Traefik creates, for each rancher service, a corresponding [service](../services
|
|||
|
||||
The Service automatically gets a server per container in this rancher service, and the router gets a default rule attached to it, based on the service name.
|
||||
|
||||
#### Service definition
|
||||
|
||||
--8<-- "content/routing/providers/service-by-label.md"
|
||||
|
||||
??? example "Automatic service assignment with labels"
|
||||
|
||||
With labels in a compose file
|
||||
|
||||
```yaml
|
||||
labels:
|
||||
- "traefik.http.routers.myproxy.rule=Host(`foo.com`)"
|
||||
# service myservice gets automatically assigned to router myproxy
|
||||
- "traefik.http.services.myservice.loadbalancer.server.port=80"
|
||||
```
|
||||
|
||||
??? example "Automatic service creation and assignment with labels"
|
||||
|
||||
With labels in a compose file
|
||||
|
||||
```yaml
|
||||
labels:
|
||||
# no service specified or defined and yet one gets automatically created
|
||||
# and assigned to router myproxy.
|
||||
- "traefik.http.routers.myproxy.rule=Host(`foo.com`)"
|
||||
```
|
||||
|
||||
### Routers
|
||||
|
||||
To update the configuration of the Router automatically attached to the container, add labels starting with `traefik.routers.{name-of-your-choice}.` and followed by the option you want to change.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue