# Shadow device storage configuration for Aerospike on Kubernetes

## Overview

You can configure the namespace storage engine in cloud environments to use extremely high-performance cloud-instance-attached local SSDs. Under this setup, writes are duplicated to another network-attached shadow device for persistence in case the cloud instance terminates.

## Set up a shadow device

1.  Follow the instructions in our [storage provisioning guide](https://aerospike.com/docs/kubernetes/4.1.x/manage/storage/storage-provisioning) to create a local volume provisioner and appropriate storage class.
    
    For more information on using a shadow device and other storage configurations, see [Namespace Storage Configuration](https://aerospike.com/docs/database/manage/namespace/storage/config).
    
2.  Add the following storage-specific configuration to the Aerospike cluster’s custom resource (CR) file.
    
    ```yaml
    storage:
    
        filesystemVolumePolicy:
    
          cascadeDelete: true
    
          initMethod: deleteFiles
    
        blockVolumePolicy:
    
          cascadeDelete: true
    
        volumes:
    
          - name: workdir
    
            aerospike:
    
              path: /opt/aerospike
    
            source:
    
              persistentVolume:
    
                storageClass: ssd
    
                volumeMode: Filesystem
    
                size: 1Gi
    
          - name: nsvol1
    
            aerospike:
    
              path: /dev/nvme0n1
    
            source:
    
              persistentVolume:
    
                storageClass: local-ssd
    
                volumeMode: Block
    
                size: 5Gi
    
          - name: nsvol2
    
            aerospike:
    
              path: /dev/sdf
    
            source:
    
              persistentVolume:
    
                storageClass: ssd
    
                volumeMode: Block
    
                size: 5Gi
    
          - name: aerospike-config-secret
    
            source:
    
              secret:
    
                secretName: aerospike-secret
    
            aerospike:
    
              path: /etc/aerospike/secret
    
      ...
    
      aerospikeConfig:
    
        service:
    
          feature-key-file: /etc/aerospike/secret/features.conf
    
        security: {}
    
        namespaces:
    
          - name: test
    
            replication-factor: 2
    
            storage-engine:
    
              type: device
    
              devices:
    
                - /dev/nvme0n1 /dev/sdf
    ```
    
    For the full CR file, see the [example shadow device cluster CR](https://github.com/aerospike/aerospike-kubernetes-operator/blob/v4.1.2/config/samples/shadow_device_cluster_cr.yaml).
    
    This and other example CRs are available in [the main Aerospike Kubernetes Operator repository](https://github.com/aerospike/aerospike-kubernetes-operator/tree/v4.1.2/config/samples).
    
3.  Save and exit the CR file, then use `kubectl` to apply the change.
    
    Terminal window
    
    ```shell
    kubectl apply -f aerospike-cluster.yaml
    ```