A journey with Traefik 2.0 in Kubernetes
Browse the slides: Use the arrows
Change chapter: Left/Right arrows
Next or previous slide: Top and bottom arrows
Overview of the slides: keyboard’s shortcut "o"
Speaker mode (and notes): keyboard’s shortcut "s"
Emile vauge
🇫🇷 Developer
Creator of Træfik, Founder of Containous
We Believe in Open Source
We Deliver Traefik and Traefik Enterprise Edition
Commercial Support
30 people distributed, 90% tech
Why, Mr Anderson?
That You Don’t Have to Write This Configuration File…?
MIT License
Written in Go
24,000+ ⭐ 1B+ ⬇️ 400+ 👷
Created in 2015, 4Y 🎂
Current stable branch: v2.0
Revamped Documentation
Clarified Concepts
Expressive Routing Rule Syntax
Middlewares
TCP Support
Canary / Mirroring
And so Much More…
With Docker Compose:
version: '3'
services:
reverse-proxy:
image: traefik:v2.0
command: --providers.docker
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
webapp:
image: containous/whoami
labels:
- "traefik.http.routers.webapp.rule=Host(`localhost`)"
# https://mycompany.org/jenkins -> http://jenkins:8080/jenkins
jenkins:
image: jenkins/jenkins:lts
environment:
- JENKINS_OPTS=--prefix=/jenkins
labels:
- "traefik.http.services.jenkins.LoadBalancer.server.Port=8080" # Because 50000 is also exposed
- "traefik.http.routers.jenkins.rule=Host(`mycompany.org`) && PathPrefix(`/jenkins`)"
- "traefik.http.routers.jenkins.service=jenkins"
# https://mycompany.org/gitserver -> http://gitserver:3000/
gitserver:
image: gitea/gitea
labels:
- "traefik.http.routers.gitserver.rule=Host(`mycompany.org`) && PathPrefix(`/gitserver`)"
- "traefik.http.middlewares.gitserver-stripprefix.stripprefix.prefixes=/gitserver"
- "traefik.http.routers.gitserver.middlewares=gitserver-stripprefix"
# https://webterminal.mycompany.org -> http://webterminal/
webterminal:
image: tsl0922/ttyd
labels:
- "traefik.http.routers.devbox.rule=Host(`webterminal.mycompany.org`)"
http:
services:
canary:
weighted:
services:
- name: appv1
weight: 3 # 75%
- name: appv2
weight: 1 #25%
appv1:
loadBalancer:
servers:
- url: "http://private-ip-server-1/"
appv2:
loadBalancer:
servers:
- url: "http://private-ip-server-2/"
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: 'traefik'
spec:
rules:
- host: localhost
http:
paths:
- path: "/whoami"
backend:
serviceName: webapp
servicePort: 80
# File "webapp.yaml"
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: simpleingressroute
spec:
entryPoints:
- web
routes:
- match: Host(`localhost`) && PathPrefix(`/whoami`)
kind: Rule
services:
- name: webapp
port: 80
$ kubectl apply -f webapp.yaml
$ kubectl get ingressroute
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
name: ingressroutetcpmongo.crd
spec:
entryPoints:
- mongotcp
routes:
- match: HostSNI(`mongo-prod`)
services:
- name: mongo-prod
port: 27017
Install it:
# Cluster Installation
traefikeectl install \
--licensekey="SuperSecretLicence" \
--dashboard \
--kubernetes # Or --swarm
Configure it:
# Routing Configuration, same as Traefik's
traefikeectl deploy \
--acme.email=ssl-admin@mycompany.org
--acme.tlsChallenge
...
Maesh is a lightweight, easy to configure, and non-invasive service mesh that allows visibility and management of the traffic flows inside any Kubernetes cluster.
Built on top of Traefik,
SMI (Service Mesh Interface specification) compliant,
Opt-in by default.
stickers!
docker run -it containous/jobs