Marathon 后端
Træfɪk 可以使用Marathon作为后端配置:
################################################################
# Mesos/Marathon 后端配置
################################################################
# 启用 Marathon 后端配置
#
# Optional
#
[marathon]
# Marathon server endpoint.
# You can also specify multiple endpoint for Marathon:
# endpoint := "http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080"
#
# Required
#
endpoint = "http://127.0.0.1:8080"
# Enable watch Marathon changes
#
# Optional
#
watch = true
# Default domain used.
#
# Required
#
domain = "marathon.localhost"
# Override default configuration template. For advanced users :)
#
# Optional
#
# filename = "marathon.tmpl"
# Expose Marathon apps by default in traefik
#
# Optional
# Default: true
#
# exposedByDefault = true
# Convert Marathon groups to subdomains
# Default behavior: /foo/bar/myapp => foo-bar-myapp.{defaultDomain}
# with groupsAsSubDomains enabled: /foo/bar/myapp => myapp.bar.foo.{defaultDomain}
#
# Optional
# Default: false
#
# groupsAsSubDomains = true
# Enable compatibility with marathon-lb labels
#
# Optional
# Default: false
#
# marathonLBCompatibility = true
# Enable Marathon basic authentication
#
# Optional
#
# [marathon.basic]
# httpBasicAuthUser = "foo"
# httpBasicPassword = "bar"
# TLS client configuration. https://golang.org/pkg/crypto/tls/#Config
#
# Optional
#
# [marathon.TLS]
# CA = "/etc/ssl/ca.crt"
# Cert = "/etc/ssl/marathon.cert"
# Key = "/etc/ssl/marathon.key"
# InsecureSkipVerify = true
# DCOSToken for DCOS environment, This will override the Authorization header
#
# Optional
#
# dcosToken = "xxxxxx"
# Override DialerTimeout
# Amount of time in seconds to allow the Marathon provider to wait to open a TCP
# connection to a Marathon master
#
# Optional
# Default: 60
# dialerTimeout = 5
# Set the TCP Keep Alive interval (in seconds) for the Marathon HTTP Client
#
# Optional
# Default: 10
#
# keepAlive = 10
Labels can be used on containers to override default behaviour:
traefik.backend=foo
: assign the application tofoo
backendtraefik.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 defaultwrr
load balancer algorithmtraefik.backend.loadbalancer.sticky=true
: enable backend sticky sessionstraefik.backend.circuitbreaker.expression=NetworkErrorRatio() > 0.5
: create a circuit breaker to be used against the backendtraefik.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 alongsidetraefik.portIndex
.traefik.protocol=https
: override the defaulthttp
protocoltraefik.weight=10
: assign this weight to the applicationtraefik.enable=false
: disable this application in Træfɪktraefik.frontend.rule=Host:test.traefik.io
: override the default frontend rule (Default:Host:{containerName}.{domain}
).traefik.frontend.passHostHeader=true
: forward clientHost
header to the backend.traefik.frontend.priority=10
: override default frontend prioritytraefik.frontend.entryPoints=http,https
: assign this frontend to entry pointshttp
andhttps
. OverridesdefaultEntryPoints
.