k3s: Enable Traefik dashboard

If you install k3s with the default settings it also installs Traefik as a load balancer. Traefik also offers a dashboard which is very easy to enable. If you go on your k3s machines to the path /var/lib/rancher/k3s/server/manifests you can find their traefik.yaml. To enable the Traefik dashboard you have to add dashboard.enabled: "true" to the yaml.

 1root@k3s-master-1:/var/lib/rancher/k3s/server/manifests# cat traefik.yaml
 2apiVersion: helm.cattle.io/v1
 3kind: HelmChart
 4metadata:
 5  name: traefik
 6  namespace: kube-system
 7spec:
 8  chart: https://%{KUBERNETES_API}%/static/charts/traefik-1.77.1.tgz
 9  set:
10    rbac.enabled: "true"
11    ssl.enabled: "true"
12    metrics.prometheus.enabled: "true"
13    kubernetes.ingressEndpoint.useDefaultPublishedService: "true"
14    dashboard.enabled: "true"
15root@k3s-master-1:/var/lib/rancher/k3s/server/manifests# cat traefik.yaml
16apiVersion: helm.cattle.io/v1
17kind: HelmChart
18metadata:
19  name: traefik
20  namespace: kube-system
21spec:
22  chart: https://%{KUBERNETES_API}%/static/charts/traefik-1.77.1.tgz
23  set:
24    rbac.enabled: "true"
25    ssl.enabled: "true"
26    metrics.prometheus.enabled: "true"
27    kubernetes.ingressEndpoint.useDefaultPublishedService: "true"
28    dashboard.enabled: "true"

After a few minutes you will see some extra pods getting started.

 1root@k3s-master-1:~# kubectl get pods -n kube-system
 2NAME                              READY   STATUS      RESTARTS   AGE
 3helm-install-traefik-4lz62        0/1     Completed   0          14d
 4coredns-66f496764-46dpj           1/1     Running     0          14d
 5svclb-traefik-kc6sx               3/3     Running     0          14d
 6svclb-traefik-tmwv6               3/3     Running     6          14d
 7svclb-traefik-24dm6               3/3     Running     3          14d
 8svclb-traefik-xxbcd               3/3     Running     3          14d
 9svclb-traefik-8n5cq               3/3     Running     3          14d
10svclb-traefik-xqf2g               3/3     Running     3          14d
11helm-install-traefik-btn4j        0/1     Completed   0          14d
12helm-install-traefik-cv7mj        0/1     Completed   0          12d
13traefik-7f759dfc78-4ds69          1/1     Running     0          12d
14metrics-server-5f476d6468-99f2s   1/1     Running     1          12d
15svclb-traefik-82wj2               3/3     Running     6          14d

Also a new endpoint is added for the Traefik Dahsboard.

1root@k3s-master-1:~# kubectl get endpoints -n kube-system
2NAME                ENDPOINTS                                   AGE
3kube-dns            10.42.0.9:53,10.42.0.9:53,10.42.0.9:9153    14d
4traefik-dashboard   10.42.5.7:8080                              12d
5traefik             10.42.5.7:80,10.42.5.7:8080,10.42.5.7:443   14d
6metrics-server      10.42.3.7:443                               12d

You can the browse to the dashboard on port 8080.

For more information about how to use Traefik and the Traefik dashboard you can go to Containous.