BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Traefik 2.0 Supports TCP, Middleware, and New Routing Features

Traefik 2.0 Supports TCP, Middleware, and New Routing Features

The release of version 2.0 of the cloud native edge router Traefik introduced several new features: TCP routing, routing based on server name identification (SNI), request middleware, canary deployments and A/B testing, and a new dashboard and web UI. The latest release also provides more tools for developers to configure and manage routes, and improved cluster traffic visibility.

Developed by the cloud infrastructure software provider Containous, Traefik is an open source reverse proxy and load balancer written in Golang. Routing in version 1 of Traefik was limited to HTTP backends, but with the latest release, one of the earliest requested feature improvements has been addressed: Traefik 2.0 now provides HTTP and TCP routing, and can support both on the same port. Traefik EntryPoints define the port that will receive requests, whether HTTP or TCP. Routers connect incoming EntryPoint requests to the services that handle them. Over TLS, Traefik routes TCP requests based on the SNI.

Traefik 2.0 also introduces middleware for altering requests before or after routing them to their destination. The middleware functionality enables chaining middleware configuration into a reusable group, which can also be configured as a Kubernetes Custom Resource Definition (CRD). Traefik comes with several pre-defined middleware configurations, such as path manipulation, authentication mechanisms, circuit breaker, retry, error handling, and IP white listing.

Canary deployments and A/B testing can be achieved with service load balancers, which act as virtual services that forward requests to the actual services. To create a gradual deployment of a new service, the new service is first defined with a unique identifier. Then a service load balancer is created, which defines the proportion of traffic for each version of the service with the weight option.

http:
  services:
    canary-api:
      weighted:
        services:
        - name: my-api-v1
          weight: 3
        - name: my-api-v2
          weight: 1

Traefik can then be configured to route traffic to this service load balancer, and the weights can be adjusted without having to redeploy the services themselves. Service load balancers can also be set up to duplicate traffic and send it to multiple services at the same time, which can be used to conduct A/B testing.

The new dashboard provides an overview of cluster traffic and the Traefik features that can be enabled. The dashboard helps users walk through each component of a system's routing configuration.

Traefik WebUI

Traefik Dashboard from the Containous blog

The Traefik documentation provides a guide for migrating from version 1 to version 2, as well as a migration tool that converts Ingress to Traefik IngressRoute resources, converts acme.json files from v1 to v2 format, and migrates the static configuration contained in the file traefik.toml to a Traefik v2 file. One of the key distinctions between the versions is that components such as frontends and backends have been replaced with the combination of routers, services, and middleware. Additional support for migrating can be found in the community forum.

Full details on Traefik version 2 can be found on the Containous blog.

Rate this Article

Adoption
Style

BT