K3S deploys traefik as its ingress controller. The traefik dashboard in not enabled by default.

To enable the traefik dashboard,

  1. SSH to the kubernetes node that is the control plane node.
  2. Make sure you are the root user. sudo su -
  3. Edit the file: /var/lib/rancher/k3s/server/manifests/traefik.yaml
  4. Add the following config to the file under spec->valuesContent. After you save the file, traefik will be redeployed and port 9000 will be exposed.
dashboard:
      enabled: true
    ports:
      traefik:
        expose: true

Example config:

---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
  name: traefik-crd
  namespace: kube-system
spec:
  chart: https://%{KUBERNETES_API}%/static/charts/traefik-crd-21.2.1+up21.2.0.tgz
---
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
  name: traefik
  namespace: kube-system
spec:
  chart: https://%{KUBERNETES_API}%/static/charts/traefik-21.2.1+up21.2.0.tgz
  set:
    global.systemDefaultRegistry: ""
  valuesContent: |-
    podAnnotations:
      prometheus.io/port: "8082"
      prometheus.io/scrape: "true"
    providers:
      kubernetesIngress:
        publishedService:
          enabled: true
    priorityClassName: "system-cluster-critical"
    image:
      repository: "rancher/mirrored-library-traefik"
      tag: "2.9.10"
    tolerations:
    - key: "CriticalAddonsOnly"
      operator: "Exists"
    - key: "node-role.kubernetes.io/control-plane"
      operator: "Exists"
      effect: "NoSchedule"
    - key: "node-role.kubernetes.io/master"
      operator: "Exists"
      effect: "NoSchedule"
    service:
      ipFamilyPolicy: "PreferDualStack"
    dashboard:
      enabled: true
    ports:
      traefik:
        expose: true

Port 9000 has been exposed

k get svc -n kube-system | grep traefik
traefik          LoadBalancer   10.43.142.163   172.16.0.21,172.16.0.22,172.16.0.23   9000:32635/TCP,80:32241/TCP,443:31724/TCP   52d
  1. Create an ingress to access the dashboard.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: traefik-ingress
  namespace: kube-system
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
    - host: traefik.home
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: traefik
                port:
                  number: 9000
  1. Access the traefik dashboard using the url: http://traefik.home/dashboard/. Replace, “traefik.home” with your hostname/ingress rule.