rancher / k3os

Purpose-built OS for Kubernetes, fully managed by Kubernetes.
https://k3os.io
Apache License 2.0
3.5k stars 397 forks source link

v0.21.1-k3s1r0: Cannot access traefik dashboard #720

Closed MarkusGeigerDev closed 3 years ago

MarkusGeigerDev commented 3 years ago

I have sucessfully installed v0.21.1-k3s1r0 on a Raspi 3B+ and I can see that the traefik service and its pod are doing fine.

k3s kubectl get ingressroutes --all-namespaces reveals that there is already an ingress route for the traefik dashboard:

NAMESPACE     NAME                AGE
kube-system   traefik-dashboard   115m

Looking at the ingress route with k3s kubectl describe ingressroute traefik-dashboard -n kube-system yields:

Name:         traefik-dashboard
Namespace:    kube-system
Labels:       app.kubernetes.io/instance=traefik
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=traefik
              helm.sh/chart=traefik-9.18.2
Annotations:  helm.sh/hook: post-install,post-upgrade
API Version:  traefik.containo.us/v1alpha1
Kind:         IngressRoute
Metadata:
  Creation Timestamp:  2021-06-16T10:58:14Z
  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:            2021-06-16T10:58:14Z
  Resource Version:  758
  UID:               8dd943da-6c64-486c-be64-33078a9d1498
Spec:
  Entry Points:
    traefik
  Routes:
    Kind:   Rule
    Match:  PathPrefix(`/dashboard`) || PathPrefix(`/api`)
    Services:
      Kind:  TraefikService
      Name:  api@internal
Events:      <none>

Still, if I enter http://[external node address]/dashboard/ in the browser of another PC, I get traefik's 404 page not found message. I know that the browser is talking to the ingress controller, because I recognoze the error message as comming from traefik.

What am I missing? Thanks in advance for any hints!

MarkusGeigerDev commented 3 years ago

Figured it out myself: The ingress route above is for the "traefik" endpoint, which is not exposed by the service.

After starting kubectl port-forward pods/<name of traefik pod> 9000:9000 I was able to access the traefik dashboard locally.

But since this is a developement machine and I wanted to access the dashboard over the network, I added the following new ingress route:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  labels:
    app.kubernetes.io/instance: traefik
    app.kubernetes.io/name: traefik
  name: traefik-dashboard-public
  namespace: kube-system
spec:
  entryPoints:
  - web
  - websecure
  routes:
  - kind: Rule
    match: PathPrefix(`/dashboard`) || PathPrefix(`/api`)
    services:
    - kind: TraefikService
      name: api@internal