K3s Traefik Ingress Controller including Dashboard
Daniel Nashed – 30 May 2023 06:06:42
The standard ingress controller for K8s is usually NGINX.
K3s uses Traefik as the out of the box ingress controller (because it needs to be available on more platforms etc.), which needs a bit different configuration compared to NGINX.
For my DNUG workshop I am looking into K3s explicitly, because it is a much smaller, easier to handle distribution for a lab environment.
RKE2 comes with NGINX. But K3s uses Traefik.
Traefik has a bit different concept and a very nice dashboard, which is disabled by default.
The dashboard itself is a good way to show how to configure a service and an ingress controller using Traefik.
I am using my own TLS secret, which I imported manually (see one of last weeks posts).
There isn't much documentation about how to define an Ingress with Traefik.
That's why I am adding this configuration below as an example.
-- Daniel
---
apiVersion: v1
kind: Service
metadata:
name: traefik-dashboard
namespace: kube-system
labels:
app.kubernetes.io/instance: traefik
app.kubernetes.io/name: traefik-dashboard
spec:
type: ClusterIP
ports:
- name: traefik
port: 9000
targetPort: traefik
protocol: TCP
selector:
app.kubernetes.io/instance: traefik-kube-system
app.kubernetes.io/name: traefik
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: traefik-dashboard
namespace: kube-system
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
ingressClassName: traefik
tls:
- secretName: tls-secret
rules:
- host: traefik.acme.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: traefik-dashboard
port:
number: 9000
---
- Comments [0]