Consul catalog backend

Træfɪk can be configured to use service discovery catalog of Consul as a backend configuration:

  1. ################################################################
  2. # Consul Catalog configuration backend
  3. ################################################################
  4. # Enable Consul Catalog configuration backend
  5. #
  6. # Optional
  7. #
  8. [consulCatalog]
  9. # Consul server endpoint
  10. #
  11. # Required
  12. #
  13. endpoint = "127.0.0.1:8500"
  14. # Default domain used.
  15. #
  16. # Optional
  17. #
  18. domain = "consul.localhost"
  19. # Prefix for Consul catalog tags
  20. #
  21. # Optional
  22. #
  23. prefix = "traefik"

This backend will create routes matching on hostname based on the service name used in consul.

Additional settings can be defined using Consul Catalog tags:

  • traefik.enable=false: disable this container in Træfɪk
  • traefik.protocol=https: override the default http protocol
  • traefik.backend.weight=10: assign this weight to the container
  • traefik.backend.circuitbreaker=NetworkErrorRatio() > 0.5
  • traefik.backend.loadbalancer=drr: override the default load balancing mode
  • 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.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.