zingi
zingi

Reputation: 1367

How to expose Traefik v2 dashboard with Kubernetes Ingress

Currently I use Traefik IngressRoute to expose the Traefik dashboard. I am using this configuration:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: traefik-dashboard
  namespace: my-namespace
spec:
  routes:
  - match: Host(`traefik.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))
    kind: Rule
    services:
    - name: api@internal
      kind: TraefikService
    middlewares:
      - name: traefik-dashboard-https-redirect
      - name: traefik-dashboard-basic-auth
  tls:
    certResolver: le

and it works fine.

However I would like to expose it with a native Kubernetes Ingress. I can't find any resource which shows how to access api@internal from an Ingress. Is it even possible?

Upvotes: 5

Views: 5548

Answers (1)

moutoum
moutoum

Reputation: 81

It is not possible to reference api@internal from an Ingress.

There is a workaround I think, which could be:

  • expose the api as insecure, it exposes the dashboard by default on an entrypoint called traefik on port 8080.
  • update the entrypoint manually in the static conf: entrypoints.traefik.address=<what-you-want>
  • create a service pointing to the traefik entrypoint (port 8080 by default).
  • create an ingress pointing to the service

Upvotes: 5

Related Questions