Rancher backend

Træfɪk can be configured to use Rancher as a backend configuration:

  1. ################################################################
  2. # Rancher configuration backend
  3. ################################################################
  4. # Enable Rancher configuration backend
  5. #
  6. # Optional
  7. #
  8. [rancher]
  9. # Default domain used.
  10. # Can be overridden by setting the "traefik.domain" label on an service.
  11. #
  12. # Required
  13. #
  14. domain = "rancher.localhost"
  15. # Enable watch Rancher changes
  16. #
  17. # Optional
  18. # Default: true
  19. #
  20. Watch = true
  21. # Expose Rancher services by default in traefik
  22. #
  23. # Optional
  24. # Default: true
  25. #
  26. ExposedByDefault = false
  27. # Endpoint to use when connecting to Rancher
  28. #
  29. # Optional
  30. # Endpoint = "http://rancherserver.example.com"
  31. # AccessKey to use when connecting to Rancher
  32. #
  33. # Optional
  34. # AccessKey = "XXXXXXXXX"
  35. # SecretKey to use when connecting to Rancher
  36. #
  37. # Optional
  38. # SecretKey = "XXXXXXXXXXX"

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.

  • io.rancher.container.create_agent=true
  • io.rancher.container.agent.role=environment
    Labels can be used on task containers to override default behaviour:

  • traefik.protocol=https: override the default http protocol

  • traefik.weight=10: assign this weight to the container
  • traefik.enable=false: disable this container in Træfɪk
  • traefik.frontend.rule=Host:test.traefik.io: override the default frontend rule (Default: Host:{containerName}.{domain}).
  • traefik.frontend.passHostHeader=true: forward client Host header to the backend.
  • traefik.frontend.priority=10: override default frontend priority
  • traefik.frontend.entryPoints=http,https: assign this frontend to entry points http and https. Overrides defaultEntryPoints.