Traefik dashboard/web UI 404 when installed via helm on Digitalocean single node cluster

11/28/2018

I am trying to set Traefik as my ingress controller and load balancer on a single node cluster(Digital Ocean). Following the official Traefik setup guide I installed Traefik using helm:

helm install --values values.yaml stable/traefik

# values.yaml
dashboard:
 enabled: true
 domain: traefik-ui.minikube
kubernetes:
 namespaces:
  - default
  - kube-system

#output
RESOURCES:
==> v1/Pod(related)
NAME                                  READY  STATUS             RESTARTS  AGE
operatic-emu-traefik-f5dbf4b8f-z9bzp  0/1    ContainerCreating  0         1s

==> v1/ConfigMap

NAME                  AGE
operatic-emu-traefik  1s

==> v1/Service
operatic-emu-traefik-dashboard  1s
operatic-emu-traefik            1s

==> v1/Deployment
operatic-emu-traefik  1s

==> v1beta1/Ingress
operatic-emu-traefik-dashboard  1s

Then I created the service exposing the Web UI kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/ui.yaml

Then I can clearly see my traefik pod running and an external-ip being assigned:

NAME                                     TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                      AGE
service/dashboard                        ClusterIP      10.245.156.214   <none>           443/TCP                      11d
service/kubernetes                       ClusterIP      10.245.0.1       <none>           443/TCP                      14d
service/operatic-emu-traefik             LoadBalancer   10.245.137.41    <external-ip>   80:31190/TCP,443:30207/TCP   5m7s
service/operatic-emu-traefik-dashboard   ClusterIP      10.245.8.156     <none>           80/TCP                       5m7s

Then opening http://external-ip/dashboard/ leads to 404 page not found

I read a ton of answers and tutorials but keep missing something. Any help is highly appreciated.

-- Mihail Panayotov
kubernetes
kubernetes-helm
traefik
traefik-ingress

2 Answers

1/15/2019

I am writing this post as the information is a bit much to fit in a comment. After spending enough time on understanding how k8s and helm charts work, this is how I solved it:

Firstly, I missed the RBAC part, I did not create ClusterRole and ClusterRoleBinding in order to authorise Traefik to use K8S API (as I am using 1.12 version). Hence, either I should have deployed ClusterRole and ClusterRoleBinding manually or added the following in my values.yaml

rbac:
  enabled: true

Secondly, I tried to access dashboard ui from ip directly without realising Traefik uses hostname to direct to its dashboard as @Rico mentioned above (I am voting you up as you did provide helpful info but I did not manage to connect all pieces of the puzzle at that time). So, either edit your /etc/hosts file linking your hostname to the external-ip and then access the dashboard via browser or test that it is working with curl:

curl http://external-ip/dashboard/ -H 'Host: traefik-ui.minikube'

To sum up, you should be able to install Traefik and access its dashboard ui by installing:

helm install --values values.yaml stable/traefik
# values.yaml
dashboard:
  enabled: true
  domain: traefik-ui.minikube
rbac:
  enabled: true
kubernetes:
  namespaces:
   - default
   - kube-system

and then editing your hosts file and opening the hostname you chose.

Now the confusing part from the official traefik setup guide is the section named Submitting an Ingress to the Cluster just below the Deploy Traefik using Helm Chart that instructs to install a service and an ingress object in order to be able to access the dashboard. This is unneeded as the official stable/traefik helm chart provides both of them. You would need that if you want to install traefik by deploying all needed objects manually. However for a person just starting out with k8s and helm, it looks like that section needs to be completed after installing helm via the official stable/traefik chart.

-- Mihail Panayotov
Source: StackOverflow

11/28/2018

I believe this is the same issue as this.

You either have to connect with the traefik-ui.minikube hostname or add a host entry on your Ingress definition like this:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  namespace: kube-system
  name: traefik-ingress
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: yourown.hostname.com
    http:
      paths:
      - path: /dashboard
        backend:
          serviceName: traefik-web-ui
          servicePort: web

You can check with:

$ kubectl -n kube-system get ingress
-- Rico
Source: StackOverflow