View on GitHub

docker-devbox

[DEV] Docker stacks to quickly setup a dev environment and test some tools.

Longhorn

Container runner Longhorn which is a cloud native distributed block storage for Kubernetes :

Longhorn nodes

System requirements

sudo apt-get install open-iscsi
sudo systemctl start iscsid && sudo systemctl enable iscsid
sudo systemctl status iscsid

Usage with Kubernetes

Read k8s-install.sh and run :

# To get dashboard on http://longhorn.dev.localhost
bash k8s-install.sh
# To get dashboard on http://longhorn.example.net
DEVBOX_HOSTNAME=example.net bash k8s-install.sh

Usage in client application

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 1Gi

Troubleshooting

Running on single node

If you don’t have at least 3 nodes, set the number of replicates (data.parameters.numberOfReplicas) to 1 :

kubectl -n longhorn-system edit cm/longhorn-storageclass

Multiple default StorageClass with K3S

Ensure that you have only one default StorageClass :

# With K3S, you might see 2 default StorageClass : local-path, longhorn
kubectl get storageclass -o wide
# To don't use longhorn as the default StorageClass :
kubectl patch storageclass longhorn -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'

Resources