Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add access to traefik dashboard #103

Closed
Issif opened this issue Sep 5, 2019 · 6 comments
Closed

[FEATURE] Add access to traefik dashboard #103

Issif opened this issue Sep 5, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@Issif
Copy link

Issif commented Sep 5, 2019

Is your feature request related to a problem or a Pull Request?

N/A

Scope of your request

I saw that traefik is used as ingress controller, which's great. Should be great to get an access to its dashboard.

Describe the solution you'd like

Expose port 8080 for access to traefik's webui (dashboard)

Describe alternatives you've considered

N/A

@Issif Issif added the enhancement New feature or request label Sep 5, 2019
@iwilltry42
Copy link
Member

Hi there, thanks for opening this feature request. I don't think, that this is an issue for k3d though, but rather for k3s.
It looks like the dashboard isn't even enabled in the traefik deployment.
You can enable it by...
a) modifying the auto-deploy files in /var/lib/rancher/k3s/server/manifests before creating the k3d cluster (you can bind mount that directory from your local machine using the --volume flag).
In the traefik.yaml file you need to add dashboard.enabled: "true" to the YAML path spec.set.
b) kubectl -n kube-system edit configmap traefik and add the following two lines at the top of the configmap:

[api]
    dashboard = true

-> then save this and exit. Then delete the existing traefik pod or wait until it reloads the config.

Then to access it from your machine, you can do one of the following:

a) use kubectl -n kube-system port-forward deployment/traefik 8080 and access via http://localhost:8080
b) kubectl -n kube-system edit service traefik and add an entry for the dashboard port 8080; then access it using kubectl proxy
c) do (b) and additionally create an ingress object (this requires you to enable ingress access in k3d (by mapping ports 80/443 using the --port flag)

Hope this helps so far 👍

@iwilltry42 iwilltry42 self-assigned this Sep 6, 2019
@Issif
Copy link
Author

Issif commented Sep 6, 2019

@iwilltry42 it helped for sure, I had access. Thanks.

As it's more related to k3s, should I create an issue on their repo? I'm sure others would like to access this UI more easily.

@iwilltry42
Copy link
Member

I'm not a maintainer of k3s, but if you think, it'd add enough value, then go ahead and open an issue over there 👍
Since it's only about adding a single line to the auto-deploy manifest, I guess it shouldn't be too much of a problem... Maybe just open a PR yourself 👍

@iwilltry42
Copy link
Member

I'll go ahead and close this issue over here 👍

@skjnldsv
Copy link

skjnldsv commented Mar 2, 2020

Btw, just adding dashboard.domain: "traefik.xxxx.com" and pointing to proper ip automatically does the job and access the dashboard (assuming you also set dashboard.enabled: "true"

@darktempla
Copy link

darktempla commented Nov 7, 2020

I know this issue is closed but I found another way to do this which hopefully helps others.

I created my k3d cluster with the following command, contextually this is important as I bind my cluster to port 8081 on my local interface.

k3d cluster create -p "8081:80@loadbalancer"

So I followed the step above and jump on the running master node and edit the /var/lib/rancher/k3s/master/manifests/traefik.yaml helm chart file adding the dashboard: true config. After saving this will automatically get applied to the cluster. As k3d spin the nodes up as docker containers you can get into the container/node like so:

docker exec -it <container_name> /bin/sh

By default the helm chart creates the first ingress (below) with host traefik.example.com by default if you don't provide the domain configuration option. If you do provide the domain it substitutes it for the default domain.

NAME                     CLASS    HOSTS                 ADDRESS        PORTS   AGE
traefik-dashboard        <none>   traefik.example.com   192.168.48.2   80      38m
traefik-dashboard-path   <none>   *                     192.168.48.2   80      4m22s

I don't want to always port forward so I simply ignore the ingress created by the helm chart and create my own custom path based ingress. Basically using the proxy 8081 -> 80 setup by k3d when I created the cluster to get my request to the traefik ingress controller.

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: traefik-dashboard-path
  annotations:
    ingress.kubernetes.io/ssl-redirect: "false"
    traefik.ingress.kubernetes.io/rule-type: "PathPrefixStrip"
spec:
  rules:
  - http:
      paths:
      - path: /traefik
        pathType: Exact
        backend:
          service:
            name: traefik-dashboard
            port:
              number: 80

You should now be able to access the dashboard on localhost at the following address:
http://localhost:8081/traefik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants