Traefik & k3d: Dashboard is not reachable

This is my k3d cluster creation command:

$ k3d cluster create arxius \
   --agents 3 \
   --k3s-server-arg --disable=traefik \
   -p "8888:80@loadbalancer" -p "9000:9000@loadbalancer" \
   --volume ${HOME}/.k3d/registries.yaml:/etc/rancher/k3s/registries.yaml

Here my nodes:

 CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                                                                   NAMES
c83f2f746621        rancher/k3d-proxy:v3.0.1   "/bin/sh -c nginx-pr…"   2 weeks ago         Up 21 minutes       0.0.0.0:9000->9000/tcp, 0.0.0.0:8888->80/tcp, 0.0.0.0:45195->6443/tcp   k3d-arxius-serverlb
0ed525443da2        rancher/k3s:v1.18.6-k3s1   "/bin/k3s agent"         2 weeks ago         Up 21 minutes                                                                               k3d-arxius-agent-2
561a0a51e6d7        rancher/k3s:v1.18.6-k3s1   "/bin/k3s agent"         2 weeks ago         Up 21 minutes                                                                               k3d-arxius-agent-1
fc131df35105        rancher/k3s:v1.18.6-k3s1   "/bin/k3s agent"         2 weeks ago         Up 21 minutes                                                                               k3d-arxius-agent-0
4cfceabad5af        rancher/k3s:v1.18.6-k3s1   "/bin/k3s server --d…"   2 weeks ago         Up 21 minutes                                                                               k3d-arxius-server-0
873a4f157251        registry:2                 "/entrypoint.sh /etc…"   3 months ago        Up About an hour    0.0.0.0:5000->5000/tcp                                                  registry.localhost

I've installed traefik using default helm installation command:

$ helm install traefik traefik/traefik

After that, an ingressroute is also installed in order to reach dashboard:

Name:         traefik-dashboard
Namespace:    traefik
Labels:       app.kubernetes.io/instance=traefik
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=traefik
              helm.sh/chart=traefik-9.1.1
Annotations:  helm.sh/hook: post-install,post-upgrade
API Version:  traefik.containo.us/v1alpha1
Kind:         IngressRoute
Metadata:
  Creation Timestamp:  2020-12-09T19:07:41Z
  Generation:          1
  Managed Fields:
    API Version:  traefik.containo.us/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:helm.sh/hook:
        f:labels:
          .:
          f:app.kubernetes.io/instance:
          f:app.kubernetes.io/managed-by:
          f:app.kubernetes.io/name:
          f:helm.sh/chart:
      f:spec:
        .:
        f:entryPoints:
        f:routes:
    Manager:         Go-http-client
    Operation:       Update
    Time:            2020-12-09T19:07:41Z
  Resource Version:  141805
  Self Link:         /apis/traefik.containo.us/v1alpha1/namespaces/traefik/ingressroutes/traefik-dashboard
  UID:               1cbcd5ec-d967-440c-ad21-e41a59ca1ba8
Spec:
  Entry Points:
    traefik
  Routes:
    Kind:   Rule
    Match:  PathPrefix(`/dashboard`) || PathPrefix(`/api`)
    Services:
      Kind:  TraefikService
      Name:  api@internal
Events:      <none>

As you can see:

Match:  PathPrefix(`/dashboard`) || PathPrefix(`/api`)

I'm trying to reach dashboard. Nevertheless:

enter image description here

Details are not shown.

I've also tried to launch a curl command:

curl 'http://localhost:9000/api/overview'
curl: (52) Empty reply from server

Any ideas?

UP

Same here using k3s.
Installed with :

curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644

I apply the following service for the UI port :

---
apiVersion: v1
kind: Service
metadata:
  name: traefik-dashboard-svc
  namespace: kube-system
  labels:
    app.kubernetes.io/name: traefik
spec:
  selector:
    app.kubernetes.io/name: traefik
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9000

Using a port-forward command kubectl -n kube-system port-forward svc/traefik-dashboard-svc 8080:80 the dashboard works as expected.

But if I create the following ingress to this service (traefik class):

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: traefik-dashboard-ing
  namespace: kube-system
  annotations:
    kubernetes.io/ingress.class: "traefik"
spec:
  rules:
  - http:
      paths:
      - path: /dashboard
        pathType: Prefix                                                                                                                                                            
        backend:
          service:
            name: traefik-dashboard-svc
            port:
              number: 80

All i get is an empty dashboard on http://localhost/dashboard/ like @jeusdi :

Anyone ?

Your issue comes from your ingress. You should have two paths, one for the dashboard, and one for the API

And this is written in the documentation. I'm sorry for that.
It works perfectly now !
Thank you for the quick answer.

1 Like