Traefik 2 as Ingress Controller on Kubernetes
Traefik is a popular edge router and has made its way in the Kubernetes world as an Ingress component. Those who used Traefik before v2.0 definitely noticed that quite a lot has changed in the new release. But don’t despair! It’s still pretty easy to setup, so let’s get started.
In the new version, Traefik dropped the use of annotations in favor of Custom Resources. This was largely requested by its community because it provides more flexibility and reduces the clutter in your yaml files. Hence the first thing you need to do to use Traefik as an Ingress Controller is create its custom resources.
In the snippets below you will find all the required resources: the Traefik Ingress Route, the Traefik TCP Ingress Route, the Traefik Middleware and the TLS Option. I will not go in a detailed explanation of each resource, the official documentation is better suited for that.
Next you need to create the Cluster Role and Cluster Role Bindings. The role definition states what resources and actions are allowed by the holder of the “traefik-ingress-controller” Service Account. This will allow Traefik to discover newly created Ingress Routes.