Kubernetes Ingress backend
Træfɪk can be configured to use Kubernetes Ingress as a backend configuration:
################################################################
# Kubernetes Ingress configuration backend
################################################################
# Enable Kubernetes Ingress configuration backend
#
# Optional
#
[kubernetes]
# Kubernetes server endpoint
#
# When deployed as a replication controller in Kubernetes,
# Traefik will use env variable KUBERNETES_SERVICE_HOST
# and KUBERNETES_SERVICE_PORT_HTTPS as endpoint
# Secure token will be found in /var/run/secrets/kubernetes.io/serviceaccount/token
# and SSL CA cert in /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
#
# Optional
#
# endpoint = "http://localhost:8080"
# namespaces = ["default","production"]
#
# See: http://kubernetes.io/docs/user-guide/labels/#list-and-watch-filtering
# labelselector = "A and not B"
#
Annotations can be used on containers to override default behaviour for the whole Ingress resource:
traefik.frontend.rule.type: PathPrefixStrip
: override the default frontend rule type (Default:PathPrefix
).
Annotations can be used on the Kubernetes service to override default behaviour:traefik.backend.loadbalancer.method=drr
: override the defaultwrr
load balancer algorithmtraefik.backend.loadbalancer.sticky=true
: enable backend sticky sessions
You can find here an example ingress and replication controller.
Additionally, an annotation can be used on Kubernetes services to set the circuit breaker expression for a backend.
traefik.backend.circuitbreaker: <expression>
: set the circuit breaker expression for the backend (Default: nil).