Understanding the 2nd method of exposing the Traefik dashboard

Hi, I am reading the traefik-helm-chart repository instructions for exposing the Traefik kubernetes dashboard:

I am curious about the second method of defining an IngressRoute. I understand this is a Traefik CRD that is used to route traffic. What I am curious about, though, is how does this IngressRoute help us connect to our cluster dashboard? The port-forward example makes sense to me, as it binds a host port to a port on the cluster. However, just because I deploy a IngressRoute on my cluster does not mean that I will be able to access it by going to "http://traefik.localhost/dashboard/" in my browser.

What is this trying to convey, then? In what situation, and with what necessary setup, will http://traefik.localhost/dashboard/ actually take me to the Traefik dashboard?

Great project, thank you very much!

Hello @sharpsteelsoftware

Thank you a lot for using Traefik.

Traefik can use the following ways of exposing service in Kubernetes:

  • Kubernetes Ingress - which is a standard Kubernetes Ingress implementation, most of the Traefik configuration can be achieved by adding annotations.
  • Kubernetes CRD - through CRD, no need to add annotations to configure Traefik, the entire configuration is managed through custom resources
  • Kubernetes Gateway API which is the evolution of Kubernetes's API, currently we support v0.4.0.

The easiest way to expose the Traefik dashboard using CRD is the following:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: dashboard
spec:
  entryPoints:
    - websecure
  routes:
    - kind: Rule
      match: Host(`d.<FIXME>.demo.traefiklabs.tech`) && PathPrefix(`/dashboard`) || PathPrefix(`/api`)
      services:
        - kind: TraefikService
          name: api@internal
      middlewares:
        - name: default-test-auth@kubernetescrd # optional
  tls:
    certResolver: le

In this recording you can find more details on how that example has been implemented on a test environment:

2 Likes