K3S & Traefik 2

This guide currently works with Traefik 2.2 but you should be able to use it without problems with future versions. If not, I will update it ! 😉

curl -sfL https://get.k3s.io | sh -s - --disable=traefik
sudo kubectl get nodes
CustomResourceDefinition.yaml
customresourcedefinition.apiextensions.k8s.io/ingressroutes.traefik.containo.us created
customresourcedefinition.apiextensions.k8s.io/middlewares.traefik.containo.us created
customresourcedefinition.apiextensions.k8s.io/ingressroutetcps.traefik.containo.us created
customresourcedefinition.apiextensions.k8s.io/ingressrouteudps.traefik.containo.us created
customresourcedefinition.apiextensions.k8s.io/tlsoptions.traefik.containo.us created
customresourcedefinition.apiextensions.k8s.io/tlsstores.traefik.containo.us created
customresourcedefinition.apiextensions.k8s.io/traefikservices.traefik.containo.us created
clusterrole.rbac.authorization.k8s.io/traefik-ingress-controller created
clusterrolebinding.rbac.authorization.k8s.io/traefik-ingress-controller created
Traefik deployment.yaml
service/traefik created
serviceaccount/traefik-ingress-controller created
deployment.apps/traefik created
Traefik 2.2 Dashboard
whoami deployment
$ curl -I http://mydomain.com
Hostname: whoami-app-84d8fbcf48-l87fj
IP: 127.0.0.1
IP: ::1
IP: 10.42.0.10
IP: fe80::2881:b7ff:fe6b:318c
RemoteAddr: 10.42.0.9:44436
GET / HTTP/1.1
Host: mydomain.com
User-Agent: curl/7.64.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 10.42.0.1
X-Forwarded-Host: mydomain.com
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: traefik-7df7bc4665-cqbbs
X-Real-Ip: 10.42.0.1
whoami with HTTPS
$ curl https://mydomain.com
Hostname: whoami-app-84d8fbcf48-l87fj
IP: 127.0.0.1
IP: ::1
IP: 10.42.0.10
IP: fe80::2881:b7ff:fe6b:318c
RemoteAddr: 10.42.0.9:44436
GET / HTTP/1.1
Host: mydomain.com
User-Agent: curl/7.64.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 10.42.0.1
X-Forwarded-Host: mydomain.com
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Forwarded-Server: traefik-7df7bc4665-cqbbs
X-Real-Ip: 10.42.0.1
Redirect HTTP to HTTPS
$ curl -I http://mydomain.com
HTTP/1.1 308 Permanent Redirect
Location: https://mydomain.com/
Date: Tue, 26 May 2020 21:05:20 GMT
Content-Length: 18
Content-Type: text/plain; charset=utf-8

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store