# OpenEBS-backed local storage for Aerospike on Kubernetes

## Overview

OpenEBS (Elastic Block Store) is an open-source platform that enables cloud-native, local or distributed persistent volume (PV) storage for Kubernetes. It is a platform-agnostic alternative to Amazon Elastic Block Store.

For more about OpenEBS, see the [official OpenEBS documentation](https://openebs.io/docs/), particularly the [Prerequisites](https://openebs.io/docs/user-guides/prerequisites).

## Planning your deployment

OpenEBS supports several types of volumes. For Aerospike clusters, use Logical Volume Manager (LVM) local PV storage volumes. OpenEBS processes nodes with LVM set up on them to create storage pools, enabling dynamic storage allocation and aggregation across devices.

::: note
Aerospike strongly discourages using replicated volumes. Aerospike already implements replication at the application level, and the additional replication could severely impact performance and reliability.

OpenEBS removed support for Local PV (Device) volumes in version 3.5. See previous versions of this AKO documentation page for instructions on setting up these legacy volumes.
:::

With an LVM local PV, Aerospike can create any number of persistent volume claims (PVCs). The aggregate size should be less than the size of the volume group.

## Install OpenEBS with Helm

1.  Run the following commands to install OpenEBS on your Kubernetes cluster with default settings.
    
    Terminal window
    
    ```bash
    helm repo add openebs https://openebs.github.io/openebs \
    
    && helm repo update \
    
    && helm install openebs --namespace openebs openebs/openebs --set engines.replicated.mayastor.enabled=false --create-namespace
    ```
    
2.  Run `get pod` to see one `lvm-controller` pod and `lvm-node` daemonset running on the nodes. You may see more pods depending on your setup.
    
    ```plaintext
    % kubectl get pod -n openebs
    
    NAME                                             READY   STATUS    RESTARTS     AGE
    
    openebs-localpv-provisioner-6bd66f8598-4zt77     1/1     Running   2 (8d ago)   26d
    
    openebs-lvm-localpv-controller-6bbd64786-pt2r7   5/5     Running   0            26d
    
    openebs-lvm-localpv-node-2bnd5                   2/2     Running   0            26d
    
    openebs-lvm-localpv-node-7d2mg                   2/2     Running   0            26d
    
    openebs-lvm-localpv-node-gz5wv                   2/2     Running   0            26d
    ```
    

[The OpenEBS installation documentation](https://openebs.io/docs/quickstart-guide/installation#installation-via-helm) includes information about customizing these settings.

## Set up an LVM local PV

The following steps guide you through a default setup process. See the [OpenEBS LVM Installation](https://openebs.io/docs/user-guides/local-storage-user-guide/local-pv-lvm/lvm-installation) documentation for a full list of options.

1.  Run `lvs` to list all volumes and verify that you have `lvm2` installed.
    
2.  Use `vgcreate` to set up a volume group that will be used by the LVM Driver for provisioning the volumes.
    
    The following example creates two volumes, then groups them into the `lvmvg` volume group.
    
    ```plaintext
    sudo pvcreate /dev/sdb1
    
      Physical volume "/dev/sdb1" successfully created.
    
    sudo pvcreate /dev/sdc1
    
      Physical volume "/dev/sdc1" successfully created.
    
    sudo vgcreate lvmvg /dev/sdb1 /dev/sdc1
    
      Volume group "lvmvg" successfully created
    ```
    
3.  Create a storage class with the `provisioner` field set to `local.csi.openebs.io`.
    
    ```plaintext
    apiVersion: storage.k8s.io/v1
    
    kind: StorageClass
    
    metadata:
    
      name: openebs-lvmpv
    
    parameters:
    
      storage: "lvm"
    
      volgroup: "lvmvg"
    
    provisioner: local.csi.openebs.io
    
    volumeBindingMode: WaitForFirstConsumer
    ```
    
4.  Install an Aerospike cluster by setting `storageClass` to the storage class you set up in the previous step to provision a local volume PVC.
    
    ```plaintext
    volumes:
    
          - name: workdir
    
            aerospike:
    
              path: /opt/aerospike
    
            source:
    
              persistentVolume:
    
                storageClass: ssd
    
                volumeMode: Filesystem
    
                size: 1Gi
    
          - name: ns1
    
            aerospike:
    
              path: /test/dev/xvdf1
    
            source:
    
              persistentVolume:
    
                storageClass: openebs-lvmpv # Storage class name
    
                volumeMode: Block
    
                size: 5Gi
    ```
    

You should now have a working Aerospike cluster with an OpenEBS backed local storage.