Merge remote-tracking branch 'upstream/v2.9' into merge-branch-v2.9-into-master
This commit is contained in:
commit
46a61ce9c8
6 changed files with 97 additions and 6 deletions
|
@ -44,10 +44,10 @@ Traefik can be installed in Kubernetes using the Helm chart from <https://github
|
||||||
|
|
||||||
Ensure that the following requirements are met:
|
Ensure that the following requirements are met:
|
||||||
|
|
||||||
* Kubernetes 1.14+
|
* Kubernetes 1.16+
|
||||||
* Helm version 3.x is [installed](https://helm.sh/docs/intro/install/)
|
* Helm version 3.9+ is [installed](https://helm.sh/docs/intro/install/)
|
||||||
|
|
||||||
Add Traefik's chart repository to Helm:
|
Add Traefik Labs chart repository to Helm:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
helm repo add traefik https://traefik.github.io/charts
|
helm repo add traefik https://traefik.github.io/charts
|
||||||
|
@ -68,6 +68,9 @@ helm install traefik traefik/traefik
|
||||||
!!! tip "Helm Features"
|
!!! tip "Helm Features"
|
||||||
|
|
||||||
All [Helm features](https://helm.sh/docs/intro/using_helm/) are supported.
|
All [Helm features](https://helm.sh/docs/intro/using_helm/) are supported.
|
||||||
|
|
||||||
|
Examples are provided [here](https://github.com/traefik/traefik-helm-chart/blob/master/EXAMPLES.md).
|
||||||
|
|
||||||
For instance, installing the chart in a dedicated namespace:
|
For instance, installing the chart in a dedicated namespace:
|
||||||
|
|
||||||
```bash tab="Install in a Dedicated Namespace"
|
```bash tab="Install in a Dedicated Namespace"
|
||||||
|
@ -83,8 +86,7 @@ helm install traefik traefik/traefik
|
||||||
as with [any helm chart](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing).
|
as with [any helm chart](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing).
|
||||||
{: #helm-custom-values }
|
{: #helm-custom-values }
|
||||||
|
|
||||||
The values are not (yet) documented, but are self-explanatory:
|
All parameters are documented in the default [`values.yaml`](https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml).
|
||||||
you can look at the [default `values.yaml`](https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml) file to explore possibilities.
|
|
||||||
|
|
||||||
You can also set Traefik command line flags using `additionalArguments`.
|
You can also set Traefik command line flags using `additionalArguments`.
|
||||||
Example of installation with logging set to `DEBUG`:
|
Example of installation with logging set to `DEBUG`:
|
||||||
|
|
|
@ -50,7 +50,12 @@ Now that we have a Traefik instance up and running, we will deploy new services.
|
||||||
Edit your `docker-compose.yml` file and add the following at the end of your file.
|
Edit your `docker-compose.yml` file and add the following at the end of your file.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# ...
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
whoami:
|
whoami:
|
||||||
# A container that exposes an API to show its IP address
|
# A container that exposes an API to show its IP address
|
||||||
image: traefik/whoami
|
image: traefik/whoami
|
||||||
|
|
|
@ -29,6 +29,12 @@ This agent can:
|
||||||
* The Traefik Hub Agent must be installed to connect to the Traefik Hub platform.
|
* The Traefik Hub Agent must be installed to connect to the Traefik Hub platform.
|
||||||
* Activate this feature in the experimental section of the static configuration.
|
* Activate this feature in the experimental section of the static configuration.
|
||||||
|
|
||||||
|
!!! information "Configuration Discovery"
|
||||||
|
|
||||||
|
According to installation options, the Traefik Hub Agent listens to the Docker or Kubernetes API to discover containers/services.
|
||||||
|
|
||||||
|
It doesn't support the routers discovered by Traefik Proxy using other providers, e.g., using the File provider.
|
||||||
|
|
||||||
!!! example "Minimal Static Configuration to Activate Traefik Hub for Docker"
|
!!! example "Minimal Static Configuration to Activate Traefik Hub for Docker"
|
||||||
|
|
||||||
```yaml tab="File (YAML)"
|
```yaml tab="File (YAML)"
|
||||||
|
|
|
@ -16,6 +16,35 @@ This will also be used as a starting point for the other docker-compose guides.
|
||||||
--8<-- "content/user-guides/docker-compose/basic-example/docker-compose.yml"
|
--8<-- "content/user-guides/docker-compose/basic-example/docker-compose.yml"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
??? Networking
|
||||||
|
|
||||||
|
The Traefik container has to be attached to the same network as the containers to be exposed.
|
||||||
|
If no networks are specified in the docker-compose file, Docker creates a default one that allows Traefik to reach the containers defined in the same file.
|
||||||
|
You can [customize the network](https://docs.docker.com/compose/networking/#specify-custom-networks) as described in the example below.
|
||||||
|
You can use a [pre-existing network](https://docs.docker.com/compose/networking/#use-a-pre-existing-network) too.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: "3.3"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefiknet: {}
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
traefik:
|
||||||
|
image: "traefik:v2.9"
|
||||||
|
...
|
||||||
|
networks:
|
||||||
|
- traefiknet
|
||||||
|
|
||||||
|
whoami:
|
||||||
|
image: "traefik/whoami"
|
||||||
|
...
|
||||||
|
networks:
|
||||||
|
- traefiknet
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
- Replace `whoami.localhost` by your **own domain** within the `traefik.http.routers.whoami.rule` label of the `whoami` service.
|
- Replace `whoami.localhost` by your **own domain** within the `traefik.http.routers.whoami.rule` label of the `whoami` service.
|
||||||
- Run `docker-compose up -d` within the folder where you created the previous file.
|
- Run `docker-compose up -d` within the folder where you created the previous file.
|
||||||
- Wait a bit and visit `http://your_own_domain` to confirm everything went fine.
|
- Wait a bit and visit `http://your_own_domain` to confirm everything went fine.
|
||||||
|
|
15
integration/fixtures/simple_debug_log.toml
Normal file
15
integration/fixtures/simple_debug_log.toml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[global]
|
||||||
|
checkNewVersion = false
|
||||||
|
sendAnonymousUsage = false
|
||||||
|
|
||||||
|
[log]
|
||||||
|
level = "DEBUG"
|
||||||
|
|
||||||
|
[api]
|
||||||
|
insecure = true
|
||||||
|
|
||||||
|
[providers.docker]
|
||||||
|
|
||||||
|
[entryPoints]
|
||||||
|
[entryPoints.webHost]
|
||||||
|
address = ":8000"
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
@ -1365,3 +1366,36 @@ func (s *SimpleSuite) TestMuxer(c *check.C) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *SimpleSuite) TestDebugLog(c *check.C) {
|
||||||
|
s.createComposeProject(c, "base")
|
||||||
|
|
||||||
|
s.composeUp(c)
|
||||||
|
defer s.composeDown(c)
|
||||||
|
|
||||||
|
file := s.adaptFile(c, "fixtures/simple_debug_log.toml", struct{}{})
|
||||||
|
defer os.Remove(file)
|
||||||
|
|
||||||
|
cmd, output := s.cmdTraefik(withConfigFile(file))
|
||||||
|
|
||||||
|
err := cmd.Start()
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
defer s.killCmd(cmd)
|
||||||
|
|
||||||
|
err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1*time.Second, try.BodyContains("PathPrefix(`/whoami`)"))
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
|
req, err := http.NewRequest(http.MethodGet, "http://localhost:8000/whoami", http.NoBody)
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
req.Header.Set("Autorization", "Bearer ThisIsABearerToken")
|
||||||
|
|
||||||
|
response, err := http.DefaultClient.Do(req)
|
||||||
|
c.Assert(err, checker.IsNil)
|
||||||
|
c.Assert(response.StatusCode, checker.Equals, http.StatusOK)
|
||||||
|
|
||||||
|
if regexp.MustCompile("ThisIsABearerToken").MatchReader(output) {
|
||||||
|
c.Logf("Traefik Logs: %s", output.String())
|
||||||
|
c.Log("Found Authorization Header in Traefik DEBUG logs")
|
||||||
|
c.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue