Longhorn-UI with Traefik?

I am running a self hosted Kubernetes Cluster with a traefik.io load balancer.
I installed the longhorn storage solution for kubernetes - everything looks fine. All pods are up and running.

My question is:

How can I publish the longhorn-ui as a service via my existing traefik load balancer?
I can see that a longhorn-frontend resource is deployed as a LoadBalacer already.

$ kubectl get services -n longhorn-system
NAME                      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
compatible-csi-attacher   ClusterIP      10.102.249.45    <none>        12345/TCP      4m35s
csi-attacher              ClusterIP      10.103.251.27    <none>        12345/TCP      4m35s
csi-provisioner           ClusterIP      10.108.167.50    <none>        12345/TCP      4m35s
longhorn-backend          ClusterIP      10.100.244.54    <none>        9500/TCP       5m3s
longhorn-frontend         LoadBalancer   10.106.215.216   <pending>     80:32699/TCP   5m3s

Can anybody give me a hint how to setup the longhorn-ui with trafik?

===
Ralph

I managed it to route the longhorn-ui via my traefik. So I can answer my question by myself. Here is my receipt:

1.) first remove the default service provided by Longhorn deployment:

$ kubectl delete service longhorn-frontend -n longhorn-system

2.) next create a service definition (longhorn-service.yaml)

apiVersion: v1
kind: Service
metadata:
  labels:
    app: longhorn-ui
  name: longhorn-frontend
  namespace: longhorn-system
spec:
  ports:
  - port: 8000
    protocol: TCP
    targetPort: 8000
    name: web
  selector:
    app: longhorn-ui

apply it:

$ kubectl apply -f longhorn-service.yaml    

3.) define a Ingress for traefik loadBalancer (longhorn-ingress.yaml)

kind: IngressRoute
apiVersion: traefik.containo.us/v1alpha1
metadata:
  name: longhorn-frontend
  namespace: longhorn-system

spec:
  entryPoints: 
    - web
  routes:
  - match: Host(`{YOUR-DNS}`) 
    kind: Rule
    services:
    - name: longhorn-frontend
      port: 8000

Replace the {YOUR-DNS} with a DNS pointing to your cluster:

apply it:

$ kubectl apply -f longhorn-ingress.yaml   

Now you can access the longhorn-ui via

http://YOUR-DNS/
2 Likes