Configuring a local StorageClass and PersistentVolume for analytics-api in Kubernetes
You can configure a local StorageClass and
PersistentVolume for analytics-api in a Kubernetes
cluster.
Before you begin
The following procedure for configuring a
StorageClass and
PersistentVolume is only acceptable for Proof of concepts (POCs) and not
recommended for production or other systems with numerous running loads.Note: The instructions
are predicated upon your volumes placement in
/mnt/local-persistent-volumes and
that analytics-api is called the data-analytics-api-0
name.Procedure
-
Set up the local storage directory if it does not exist.
For example:
mkdir -p /mnt/local-persistent-volumes/data-analytics-api-0 -
Ensure the directory is owned by a user with
uid:1000and assigned a group withgid:1000.Theanalytics-apiservice runs as the user elasticsearch(uid:1000,gid:1000)in the container, and the user and group ids must match. -
Write the following example to a file.
Kubernetes
StorageClassinformation can be found here.File: local-storageclass.yamlExample:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: local-storage provisioner: kubernetes.io/no-provisioner volumeBindingMode: WaitForFirstConsumer -
Create the
StorageClassby applying the yaml file.For example: kubectl apply -f local-storageclass.yaml -
Write the following example to a file.
Kubernetes
PersistentVolumeinformation can be found here.File: analytics-api-persistentvolume.yamlExample:
apiVersion: v1 kind: PersistentVolume metadata: name: data-analytics-api-0 spec: capacity: storage: 8Gi volumeMode: Filesystem accessModes: - ReadWriteOnce claimRef: namespace: {{whatever your installation namespace is e.g. 'default'}} name: data-analytics-api-0 persistentVolumeReclaimPolicy: Delete storageClassName: local-storage local: path: /mnt/local-persistent-volumes/data-analytics-api-0 nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: - {{the kubernetes.io/hostname value on the node on which you want to create local volumes}} -
Create the
PersistentVolumeby applying the yaml file.For example: kubectl apply -f analytics-api-persistentvolume.yaml -
Install
HCL™ Accelerate with the
analyticsbeta feature. -
Verify that the
analytics-api-0pod advances to statusRunning 1/1.
Results
You should have a new StorageClass and new PersistentVolume
created as shown in the example below.
# kubectl get sc,pv
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
storageclass.storage.k8s.io/local-storage kubernetes.io/no-provisioner Delete WaitForFirstConsumer false 16h
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
persistentvolume/data-analytics-api-0 8Gi RWO Delete Bound default/data-analytics-api-0 local-storage 16h