Difficulty: beginner
Estimated Time: 10-15 minutes


TL;DR; Traefik is an edge router, first released in 2015. It does load balancing, routing, IP white listing, SSL offloading, header rewriting, health checking, circuit breaking and service discovery. It supports dynamic reconfiguration, exposes metrics for monitoring and can be run in cluster configuration. Traefik plays very nicely with orchestation platforms - such as Kubernetes, Mesos, Swarm and Docker Engine - as well as service discovery components and configuration tools such as Consul, Eureka, etcd, Zookeeper.

Traefik compares with HAProxy, NGinxm, Apache HTTP Server, AWS Elastic Load Balancing, Kong, Zuul and even Varnish (web application accelerator also known as a caching HTTP reverse proxy) and hardware load balancers.


In this scenario, you will spin up a number of Docker containers. One for Traefik and two more for services that Traefik will front and route requests to and load balances requests over.

You will get a feel for the bare functionality of Traefik - and how to get it going.

Wow! Well Done!

You have seen Traefik in action - as edge router and load balancer, able to dynamically adapt to new containers and additional container instances.

There is much more to discover.

Other fun topics

  • Health Checks
  • Circuit Breaking (take a badly performing backend server out of the pool)
  • Header Manipulation
  • Timeout
  • IP White Listing
  • Canary Release (using load balancing with uneven weights for new release end point vs existing release)
  • Throttling (rate limiting)


Traefik Homepage: https://traefik.io/ Traefik Documentation: https://docs.traefik.io/

Getting Started Scenario: https://docs.traefik.io/

Also check out this other Katacode scenario: Load Balance Containers using Traefik

The sources for this Katacoda scenario are also available: [GitHub](https://github.com/lucasjellema/katacoda-scenarios/tree/master/httpsgithubcomlucasjellemakatacoda-scenarios.

Traefik and Docker Compose in action

Step 1 of 4

Run Traefik using Docker Compose

Execute this command to run docker-compose docker-compose up -d

When the previous command is complete, check the Docker containers running docker ps

Checkout the Traefik dashboard - by click on the tab labeled Traefik Dashboard or by clicking on this link: https://[[HOST_SUBDOMAIN]]-8080-[[KATACODA_HOST]].environments.katacoda.com/dashboard/

The Traefik metrics are available at: https://[[HOST_SUBDOMAIN]]-8080-[[KATACODA_HOST]].environments.katacoda.com/metrics

The Traefik API is exposed at: https://[[HOST_SUBDOMAIN]]-8080-[[KATACODA_HOST]].environments.katacoda.com/api

Visualise Host
Traefik Dashboard