diff --git a/docs/toml.md b/docs/toml.md index e3d4ae678..206b81bbd 100644 --- a/docs/toml.md +++ b/docs/toml.md @@ -1583,25 +1583,24 @@ ExposedByDefault = false # Endpoint to use when connecting to Rancher # -# Optional -# Endpoint = "http://rancherserver.example.com" +# Required +# Endpoint = "http://rancherserver.example.com/v1" # AccessKey to use when connecting to Rancher # -# Optional -# AccessKey = "XXXXXXXXX" +# Required +# AccessKey = "XXXXXXXXXXXXXXXXXXXX" # SecretKey to use when connecting to Rancher # -# Optional -# SecretKey = "XXXXXXXXXXX" +# Required +# SecretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ``` -If you're deploying traefik as a service within rancher, you can alternatively set these labels on the service to let it only fetch data of its current environment. The settings `endpoint`, `accesskey` and `secretkey` can be omitted then. +As traefik needs access to the rancher API, you need to set the `endpoint`, `accesskey` and `secretkey` parameters. -- `io.rancher.container.create_agent=true` -- `io.rancher.container.agent.role=environment` +To enable traefik to fetch information about the Environment it's deployed in only, you need to create an `Environment API Key`. This can be found within the API Key advanced options. Labels can be used on task containers to override default behaviour: diff --git a/examples/compose-rancher.yml b/examples/compose-rancher.yml index cd4e0f677..8eddcf589 100644 --- a/examples/compose-rancher.yml +++ b/examples/compose-rancher.yml @@ -1,9 +1,6 @@ traefik: image: traefik - command: --web --rancher --rancher.domain=rancher.localhost --logLevel=DEBUG - labels: - io.rancher.container.agent.role: environment - io.rancher.container.create_agent: 'true' + command: --web --rancher --rancher.domain=rancher.localhost --rancher.endpoint=http://example.com --rancher.accesskey=XXXXXXX --rancher.secretkey=YYYYYY --logLevel=DEBUG ports: - "80:80" - "443:443" diff --git a/traefik.sample.toml b/traefik.sample.toml index dc466dd49..12c4a0f1e 100644 --- a/traefik.sample.toml +++ b/traefik.sample.toml @@ -1006,43 +1006,43 @@ # # Optional # -#[rancher] +# [rancher] # Default domain used. # Can be overridden by setting the "traefik.domain" label on an service. # # Required # -#domain = "rancher.localhost" +# domain = "rancher.localhost" # Enable watch Rancher changes # # Optional # Default: true # -#Watch = true +# Watch = true # Expose Rancher services by default in traefik # # Optional # Default: true # -#ExposedByDefault = false +# ExposedByDefault = false # Endpoint to use when connecting to Rancher # -# Optional -# Endpoint = "http://rancherserver.example.com" +# Required +# Endpoint = "http://rancherserver.example.com/v1" # AccessKey to use when connecting to Rancher # -# Optional -# AccessKey = "XXXXXXXXX" +# Required +# AccessKey = "XXXXXXXXXXXXXXXXXXXX" # SecretKey to use when connecting to Rancher # -# Optional -# SecretKey = "XXXXXXXXXXX" +# Required +# SecretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ################################################################