Merge current v2.11 into v3.1
This commit is contained in:
commit
2ffa6c6feb
17 changed files with 266 additions and 74 deletions
|
@ -22,7 +22,7 @@ With Docker, Traefik can leverage labels attached to a container to generate rou
|
|||
|
||||
## Configuration Examples
|
||||
|
||||
??? example "Configuring Docker & Deploying / Exposing Services"
|
||||
??? example "Configuring Docker & Deploying / Exposing one Service"
|
||||
|
||||
Enabling the docker provider
|
||||
|
||||
|
@ -109,7 +109,7 @@ and the router automatically gets a rule defined by `defaultRule` (if no rule fo
|
|||
|
||||
--8<-- "content/routing/providers/service-by-label.md"
|
||||
|
||||
??? example "Automatic service assignment with labels"
|
||||
??? example "Automatic assignment with one Service"
|
||||
|
||||
With labels in a compose file
|
||||
|
||||
|
@ -120,7 +120,7 @@ and the router automatically gets a rule defined by `defaultRule` (if no rule fo
|
|||
- "traefik.http.services.myservice.loadbalancer.server.port=80"
|
||||
```
|
||||
|
||||
??? example "Automatic service creation and assignment with labels"
|
||||
??? example "Automatic service creation with one Router"
|
||||
|
||||
With labels in a compose file
|
||||
|
||||
|
@ -131,6 +131,18 @@ and the router automatically gets a rule defined by `defaultRule` (if no rule fo
|
|||
- "traefik.http.routers.myproxy.rule=Host(`example.net`)"
|
||||
```
|
||||
|
||||
??? example "Explicit definition with one Service"
|
||||
|
||||
With labels in a compose file
|
||||
|
||||
```yaml
|
||||
labels:
|
||||
- traefik.http.routers.www-router.rule=Host(`example-a.com`)
|
||||
# Explicit link between the router and the service
|
||||
- traefik.http.routers.www-router.service=www-service
|
||||
- traefik.http.services.www-service.loadbalancer.server.port=8000
|
||||
```
|
||||
|
||||
### Routers
|
||||
|
||||
To update the configuration of the Router automatically attached to the container,
|
||||
|
@ -433,7 +445,7 @@ More information about available middlewares in the dedicated [middlewares secti
|
|||
|
||||
You can declare TCP Routers and/or Services using labels.
|
||||
|
||||
??? example "Declaring TCP Routers and Services"
|
||||
??? example "Declaring TCP Routers with one Service"
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
@ -571,7 +583,7 @@ You can declare TCP Routers and/or Services using labels.
|
|||
|
||||
You can declare UDP Routers and/or Services using labels.
|
||||
|
||||
??? example "Declaring UDP Routers and Services"
|
||||
??? example "Declaring UDP Routers with one Service"
|
||||
|
||||
```yaml
|
||||
services:
|
||||
|
|
|
@ -22,7 +22,7 @@ With Docker Swarm, Traefik can leverage labels attached to a service to generate
|
|||
|
||||
## Configuration Examples
|
||||
|
||||
??? example "Configuring Docker Swarm & Deploying / Exposing Services"
|
||||
??? example "Configuring Docker Swarm & Deploying / Exposing one Service"
|
||||
|
||||
Enabling the docker provider (Swarm Mode)
|
||||
|
||||
|
@ -50,7 +50,9 @@ With Docker Swarm, Traefik can leverage labels attached to a service to generate
|
|||
--providers.swarm.endpoint=tcp://127.0.0.1:2377
|
||||
```
|
||||
|
||||
Attach labels to services (not to containers) while in Swarm mode (in your docker compose file)
|
||||
Attach labels to services (not containers) while in Swarm mode (in your Docker compose file).
|
||||
When there is only one service, and the router does not specify a service,
|
||||
then that service is automatically assigned to the router.
|
||||
|
||||
```yaml
|
||||
version: "3"
|
||||
|
@ -67,6 +69,30 @@ With Docker Swarm, Traefik can leverage labels attached to a service to generate
|
|||
Therefore, if you use a compose file with Swarm Mode, labels should be defined in the `deploy` part of your service.
|
||||
This behavior is only enabled for docker-compose version 3+ ([Compose file reference](https://docs.docker.com/compose/compose-file/compose-file-v3/#labels-1)).
|
||||
|
||||
??? example "Specify a Custom Port for the Container"
|
||||
|
||||
Forward requests for `http://example.com` to `http://<private IP of container>:12345`:
|
||||
|
||||
```yaml
|
||||
version: "3"
|
||||
services:
|
||||
my-container:
|
||||
# ...
|
||||
deploy:
|
||||
labels:
|
||||
- traefik.http.routers.my-container.rule=Host(`example.com`)
|
||||
- traefik.http.routers.my-container.service=my-service"
|
||||
# Tell Traefik to use the port 12345 to connect to `my-container`
|
||||
- traefik.http.services.my-service.loadbalancer.server.port=12345
|
||||
```
|
||||
|
||||
!!! important "Traefik Connecting to the Wrong Port: `HTTP/502 Gateway Error`"
|
||||
By default, Traefik uses the lowest exposed port of a container as detailed in
|
||||
[Port Detection](../providers/swarm.md#port-detection) of the Swarm provider.
|
||||
|
||||
Setting the label `traefik.http.services.xxx.loadbalancer.server.port`
|
||||
overrides this behavior.
|
||||
|
||||
??? example "Specifying more than one router and service per container"
|
||||
|
||||
Forwarding requests to more than one port on a container requires referencing the service loadbalancer port definition using the service parameter on the router.
|
||||
|
@ -232,7 +258,7 @@ you'd add the label `traefik.http.services.<name-of-your-choice>.loadbalancer.pa
|
|||
Registers a port.
|
||||
Useful when the container exposes multiples ports.
|
||||
|
||||
Mandatory for Docker Swarm (see the section ["Port Detection with Docker Swarm"](../../providers/docker.md#port-detection)).
|
||||
Mandatory for Docker Swarm (see the section ["Port Detection with Docker Swarm"](../../providers/swarm.md#port-detection)).
|
||||
{: #port }
|
||||
|
||||
```yaml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue