How to attach storage volume with elasticsearch nodes in kubernetes?

5/30/2019

I am doing setup of Elasticseach on Kubernetes. I have created the cluster of Elasticsearch of 2 nodes. I want to attach storage with both of these nodes. like 80Gi with the first node and 100Gi with the second node. My Kubernetes cluster is on EC2 and I am using EBS as storage.

-- a2hksy
amazon-ec2
elasticsearch
kubernetes

2 Answers

5/30/2019

In order to attach persistence, you need:

  • A StorageClass Object (Define the Storage)
  • A PersistentVolume Object (Provision the Storage)
  • A PersistentVolumeClaim Object (Attach the storage)

With each Node in ElasticSearch that you can attached with the pods in deployment\pod object definition.

An easier way is deploying ES cluster using Helm Chart.

-- Janshair Khan
Source: StackOverflow

6/28/2019

As per helm chart documentation:

Automated testing of this chart is currently only run against GKE (Google Kubernetes Engine). If you are using a different Kubernetes provider you will likely need to adjust the storageClassName in the volumeClaimTemplate

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: elast
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
  fsType: ext4 

Hope this help.

-- Hanx
Source: StackOverflow