Kubernetes Ingress backend

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

  1. ################################################################
  2. # Kubernetes Ingress configuration backend
  3. ################################################################
  4. # Enable Kubernetes Ingress configuration backend
  5. #
  6. # Optional
  7. #
  8. [kubernetes]
  9. # Kubernetes server endpoint
  10. #
  11. # When deployed as a replication controller in Kubernetes,
  12. # Traefik will use env variable KUBERNETES_SERVICE_HOST
  13. # and KUBERNETES_SERVICE_PORT_HTTPS as endpoint
  14. # Secure token will be found in /var/run/secrets/kubernetes.io/serviceaccount/token
  15. # and SSL CA cert in /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
  16. #
  17. # Optional
  18. #
  19. # endpoint = "http://localhost:8080"
  20. # namespaces = ["default","production"]
  21. #
  22. # See: http://kubernetes.io/docs/user-guide/labels/#list-and-watch-filtering
  23. # labelselector = "A and not B"
  24. #

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 default wrr load balancer algorithm

  • traefik.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).