Skip to main content
Loading
Version: Operator 2.4.0

Use Persistent Memory (PMEM) for Aerospike on Kubernetes

This example creates a cluster where Aerospike data and index use Persistent Memory (PMEM) storage.

Prerequisites

Hardware

  • Persistent Memory (PMEM) devices installed on the Kubernetes nodes

Software

In addition to the Aerospike Kubernetes Operator, install PMEM-CSI driver for Kubernetes which makes PMEM available to Aerospike clusters, running on Kubernetes, as filesystem volumes.

Installing PMEM-CSI involves

We recommend using the PMEM-CSI Operator to install the PMEM-CSI driver.

Create the PMEM storage class

Once the PMEM-CSI driver has been installed, create a file pmem-csi-sc-late-binding.yml with the following content.

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: pmem-csi-sc-late-binding
provisioner: pmem-csi.intel.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer

Create the storage class

kubectl apply -f pmem-csi-sc-late-binding.yml

Aerospike cluster using PMEM

For more information on PMEM and other storage configurations, see the Aerospike documentation for namespace storage configuration.

To create an Aerospike Cluster that uses PMEM, see the example Aerospike CR below:

apiVersion: asdb.aerospike.com/v1beta1
kind: AerospikeCluster
metadata:
name: aerocluster
namespace: aerospike

spec:
size: 2
image: aerospike/aerospike-server-enterprise:6.1.0.1

storage:
filesystemVolumePolicy:
initMethod: deleteFiles
cascadeDelete: true
blockVolumePolicy:
cascadeDelete: true
volumes:
- name: workdir
aerospike:
path: /opt/aerospike
source:
persistentVolume:
storageClass: ssd
volumeMode: Filesystem
size: 1Gi
- name: pmem-data
aerospike:
path: /mnt/pmem0
source:
persistentVolume:
storageClass: pmem-csi-sc-late-binding
volumeMode: Filesystem
size: 1.5Gi
- name: pmem-index
aerospike:
path: /mnt/pmem1
source:
persistentVolume:
storageClass: pmem-csi-sc-late-binding
volumeMode: Filesystem
size: 1.5Gi
- name: aerospike-config-secret
source:
secret:
secretName: aerospike-secret
aerospike:
path: /etc/aerospike/secret

podSpec:
multiPodPerHost: false

aerospikeAccessControl:
users:
- name: admin
secretName: auth-secret
roles:
- sys-admin
- user-admin
- data-admin
- read
- write

aerospikeConfig:
service:
feature-key-file: /etc/aerospike/secret/features.conf
security: { }
network:
service:
port: 3000
fabric:
port: 3001
heartbeat:
port: 3002
namespaces:
- name: test
memory-size: 3000000000
replication-factor: 2
storage-engine:
type: pmem
files:
- /mnt/pmem0/test.data
filesize: 1073741824
index-type:
type: pmem
mounts:
- /mnt/pmem1
mounts-size-limit: 1073741824

This example create storage volumes for

  • index on PMEM
  • storage on PMEM

You should change the allocated PMEM size, namespace memory, and namespace file size limits based on your needs.

For the full CR file, see the example PMEM cluster CR.

This and other example CRs are stored in the main Aerospike Kubernetes Operator repository.

Save and exit the CR file, then use kubectl to apply the change.

kubectl apply -f aerospike-cluster.yaml