DEV Community

Cover image for Longhorn on Raspbian 64 with WSL with Dashboard
Chris Carr
Chris Carr

Posted on

Longhorn on Raspbian 64 with WSL with Dashboard

I have a Raspberry Pi cluster with three nodes including the control plane running on 3 Raspberry Pi 4's with 8Gb RAM. The control plane (k8s-pi) has a USB SSD attached from which it boots Kubernetes (well, k3s). It also runs on Raspbian 64 which is an experimental release.
There are numerous posts already that explain how to achieve this setup. This post is specifically about how to use the control plane SSD as a persistent volume using Longhorn.
K3s comes with Rancher’s Local Path Provisioner, but I wanted to use Longhorn, an open-source distributed block storage system for Kubernetes.
Longhorn mentions in its' documentation that it supports ARM64 (experimental).
Note: This cluster has not been built to run anything remotely like a production system - it's purely for my own enjoyment, so piling on the experimental features is fine.

Before you start, install open-iscsi on each node in the cluster (thanks Bryan for the tip)

sudo apt-get install open-iscsi
Enter fullscreen mode Exit fullscreen mode

Now to install longhorn, the documentation that you find here

(https://longhorn.io/docs/0.8.0/install/install-with-kubectl/) 
Enter fullscreen mode Exit fullscreen mode

says to use

kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v0.8.0/deploy/longhorn.yaml
Enter fullscreen mode Exit fullscreen mode

However after failing to get this to work, a quick look into docker hub lists this tagged version as supporting only linux/amd64.
image
We need ARM because we're deploying on a Raspberry Pi, so where is the ARM version? Following the tags for this image in docker hub, we discover that we need v1.1.2 (this is the latest release at time of writing)
image
So we can simply change the path in the above link to the v1.1.2 of the yaml file like so

kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.1.2/deploy/longhorn.yaml
Enter fullscreen mode Exit fullscreen mode

Longhorn took about ten minutes to start on my setup. You can monitor the startup by using

kubectl get po -n longhorn-system --watch
Enter fullscreen mode Exit fullscreen mode

It created about ten pods per node on my system.
Now to create the ingress for the longhorn dashboard (again thanks to Bryan copy this into ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: longhorn-system
  name: longhorn-ingress
  annotations:
    kubernetes.io/ingress.class: "traefik"
spec:
  rules:
  - host: longhorn-ui
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: longhorn-frontend
            port:
              number: 80
Enter fullscreen mode Exit fullscreen mode

and run

kubectl apply -f ingress.yaml
Enter fullscreen mode Exit fullscreen mode

Now, if you're using WSL you'll have to edit the windows hosts file on your local machine. Remember to do this as admin. The hosts file is usually located here on Windows 10.

C:\Windows\System32\drivers\etc\hosts
Enter fullscreen mode Exit fullscreen mode

The host entry below identifies the node on which the SSD is attached. On my system, this is the control plane which has the IP address 192.168.1.100, so there is a line in my hosts file like so

192.168.1.100 k8s-pi longhorn-ui
Enter fullscreen mode Exit fullscreen mode

This is because I also reference the control plane as k8s-pi - you just need the longhorn-ui entry appended to the control plane IP
Now you should be able to see your dashboard at

http://longhorn-ui
Enter fullscreen mode Exit fullscreen mode

image

Top comments (0)