How to utilize longhorn with Rancher?

Here is my current setup:

Server specifically for Rancher at rancher.domain.com

And then I created clusters with some services etc…

Shall I create another server specifically for longhorn? if not, then what needs to be done to do so or how it should be?

And how to connect it to Rancher to be used by my clusters?

  1. Each node in the cluster must have open-iscsi installed. Do that first…

  2. Run the Environment check script that longhorn provides…

  3. Deploy longhorn onto the cluster:

  4. Create your longhorn storage class:

  5. Launch the Longhorn UI

    • Find the Longhorn Frontend service:
      –> kubectl -n longhorn-system get svc
      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
      csi-attacher ClusterIP 10.43.102.193 <none> 12345/TCP 1h
      csi-provisioner ClusterIP 10.43.227.10 <none> 12345/TCP 1h
      longhorn-backend ClusterIP 10.43.178.152 <none> 9500/TCP 1h
      longhorn-frontend NodePort 10.43.161.134 <none> 80 :30987 /TCP 13s
  1. Launch a test pod to see if it works:
    • apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
      name: longhorn-volv-pvc
      namespace: default
      spec:
      accessModes:
  • ReadWriteOnce
    storageClassName: longhorn
    resources:
    requests:
    storage: 2Gi

apiVersion: v1
kind: Pod
metadata:
name: volume-test
namespace: default
spec:
containers:

  • name: volume-test
    image: nginx:stable-alpine
    imagePullPolicy: IfNotPresent
    volumeMounts:
  • name: volv
    mountPath: /data
    ports:
  • containerPort: 80
    volumes:
  • name: volv
    persistentVolumeClaim:
    claimName: longhorn-volv-pvc