Marathon 后端

Træfɪk 可以使用Marathon作为后端配置:

  1. ################################################################
  2. # Mesos/Marathon 后端配置
  3. ################################################################
  4. # 启用 Marathon 后端配置
  5. #
  6. # Optional
  7. #
  8. [marathon]
  9. # Marathon server endpoint.
  10. # You can also specify multiple endpoint for Marathon:
  11. # endpoint := "http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080"
  12. #
  13. # Required
  14. #
  15. endpoint = "http://127.0.0.1:8080"
  16. # Enable watch Marathon changes
  17. #
  18. # Optional
  19. #
  20. watch = true
  21. # Default domain used.
  22. #
  23. # Required
  24. #
  25. domain = "marathon.localhost"
  26. # Override default configuration template. For advanced users :)
  27. #
  28. # Optional
  29. #
  30. # filename = "marathon.tmpl"
  31. # Expose Marathon apps by default in traefik
  32. #
  33. # Optional
  34. # Default: true
  35. #
  36. # exposedByDefault = true
  37. # Convert Marathon groups to subdomains
  38. # Default behavior: /foo/bar/myapp => foo-bar-myapp.{defaultDomain}
  39. # with groupsAsSubDomains enabled: /foo/bar/myapp => myapp.bar.foo.{defaultDomain}
  40. #
  41. # Optional
  42. # Default: false
  43. #
  44. # groupsAsSubDomains = true
  45. # Enable compatibility with marathon-lb labels
  46. #
  47. # Optional
  48. # Default: false
  49. #
  50. # marathonLBCompatibility = true
  51. # Enable Marathon basic authentication
  52. #
  53. # Optional
  54. #
  55. # [marathon.basic]
  56. # httpBasicAuthUser = "foo"
  57. # httpBasicPassword = "bar"
  58. # TLS client configuration. https://golang.org/pkg/crypto/tls/#Config
  59. #
  60. # Optional
  61. #
  62. # [marathon.TLS]
  63. # CA = "/etc/ssl/ca.crt"
  64. # Cert = "/etc/ssl/marathon.cert"
  65. # Key = "/etc/ssl/marathon.key"
  66. # InsecureSkipVerify = true
  67. # DCOSToken for DCOS environment, This will override the Authorization header
  68. #
  69. # Optional
  70. #
  71. # dcosToken = "xxxxxx"
  72. # Override DialerTimeout
  73. # Amount of time in seconds to allow the Marathon provider to wait to open a TCP
  74. # connection to a Marathon master
  75. #
  76. # Optional
  77. # Default: 60
  78. # dialerTimeout = 5
  79. # Set the TCP Keep Alive interval (in seconds) for the Marathon HTTP Client
  80. #
  81. # Optional
  82. # Default: 10
  83. #
  84. # keepAlive = 10

Labels can be used on containers to override default behaviour:

  • traefik.backend=foo: assign the application to foo backend
  • traefik.backend.maxconn.amount=10: set a maximum number of connections to the backend. Must be used in conjunction with the below label to take effect.
  • traefik.backend.maxconn.extractorfunc=client.ip: set the function to be used against the request to determine what to limit maximum connections to the backend by. Must be used in conjunction with the above label to take effect.
  • traefik.backend.loadbalancer.method=drr: override the default wrr load balancer algorithm
  • traefik.backend.loadbalancer.sticky=true: enable backend sticky sessions
  • traefik.backend.circuitbreaker.expression=NetworkErrorRatio() > 0.5: create a circuit breaker to be used against the backend
  • traefik.portIndex=1: register port by index in the application's ports array. Useful when the application exposes multiple ports.
  • traefik.port=80: register the explicit application port value. Cannot be used alongside traefik.portIndex.
  • traefik.protocol=https: override the default http protocol
  • traefik.weight=10: assign this weight to the application
  • traefik.enable=false: disable this application 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.