Installing and Setting Up Longhorn Storage

Installation of Foresight Mobile Platform creates several containers with persistent storage data (StatefulSets) that require significant disk space and volume backing-up. By default, Deckhouse includes the StorageClass named localpath-deckhouse. This class provides creating of persistent volumes, but does not provide backing-up. The Longhorn storage class provides volume backing-up.

To install and set up the Longhorn storage, execute the operations on the first main node:

  1. Create the longhorn-values.yaml file with contents:

defaultSettings:
 defaultDataPath: /mnt/longhorn/data
ingress:
 enabled: true
 host: <host>

In the <host> substitution specify IP address or DNS name, by which Longhorn is available, for example, longhorn.dk1.internal.

In the defaultDataPath parameters specify path to the volume mount folder created at Step 5 during LVM section creation. If the section was not created, delete this parameter.

  1. Create the longhorn-system namespace:

sudo /opt/deckhouse/bin/kubectl create ns longhorn-system

  1. Grant maximum privileges for pods to the longhorn-system namespace:

sudo /opt/deckhouse/bin/kubectl label ns longhorn-system security.deckhouse.io/pod-policy=privileged

  1. Install the Longhorn repository:

helm repo add longhorn https://charts.longhorn.io
helm repo update

  1. Install the Longhorn storage:

helm install longhorn longhorn/longhorn --namespace longhorn-system --set defaultSettings.defaultDataPath="/mnt/longhorn/data"

In the defaultDataPath parameters specify path to the volume mount folder created at Step 5 during LVM section creation. If the section was not created, execute the command without additional parameters:

helm install longhorn longhorn/longhorn --namespace longhorn-system

  1. Apply the settings specified in the longhorn-values.yaml file:

helm upgrade longhorn longhorn/longhorn --namespace longhorn-system --values ./longhorn-values.yaml --version `helm list -n longhorn-system -o json | jq -r .'[0].app_version'`

  1. Make sure that the Longhorn host corresponds to IP address of the Deckhouse first main node.

  2. Open Longhorn in the browser via the host specified in the "host" parameter in the longhorn-values.yaml file. After this go to the Nodes tab and make sure that the directory for storing specified in the defaultDataPath parameter is specified.

NOTE. If the longhorn-values.yaml file does not use the defaultDataPath parameter, skip this step.

  1. Install the Longhorn storage by default:

sudo /opt/deckhouse/bin/kubectl annotate sc longhorn storageclass.kubernetes.io/is-default-class='true'

After executing the operations the Longhorn storage is installed and set up on the main node.

Next, install the Docker image local storage.

See also:

Preparation and Deployment of Fault-Tolerant Cluster Based on Deckhouse | Installing Docker Image Local Storage