Traefik V2 Brings alot of new content that did not exist in version 1. This post is to introduce you to these new changes.
One of the biggest changes was the redesign of core features, such as Frontends and Backends. These have since been removed and have been replaced with middlewares, routers and services. More specifically a router is usually the equivalent of a frontend and a service is the equivalent of a backend.
In my opinion I feel that middlewares was the biggest change. A middleware is attached to the routers, which is then is used to modify requests before they are sent to the service for example some middlewares can include ratelimit, basic authentication and strip. You can view more information about middlewares Here
Originally in version 1 TLS used to be configured using entrypoint that was applied to all services. Now with Version 2 you can create a TLS configuration per service. fYou can define the certificates using the following
tls: stores: default: defaultCertificate: certFile: /certs/cert.crt keyFile: /certs/cert.key
Then to add it to a service you would add
labels: - "traefik.http.routers.web-secure.entrypoints=https" - "traefik.http.routers.web-secure.tls=true" - "traefik.http.routers.web-secure.rule=Host(`example.co.nz`)"
Originally the only supported configuration mechanism was TOML, Now with version 2 you can use either TOML or YAML, I personally prefer YAML as it seems to be easier for me to understand but it can depend on the person.
Overall when I was making the switch from version 1 to version 2 it was definitely a challenge for me as I had to rewrite majority of my configs as they become broken in the upgrade. But once i managed to make the change I was really happy with the upgrade as I feel it gives me alot more control. If you want to learn how to deploy Traefik V2 using docker swarm you can read a previous blog post of mine Here