Deploy Elastic Search with Kubernetes StatefulSet cannot persist the index data

Hi All,

I'm deploying Elastic Search as StatefulSet in Kubernetes, but cannot make the persistent volume working properly. (Reference:, I don't create dedicated master, so simply master & data are in one).

I'm testing the persistent volume by:

  1. create ES and insert some data;
  2. delete and re-create the service;
  3. check if the index is still there.

The deployment showed all green, and the elastic search is also working fine. But the data is not persistent if I re-create the ES. Could someone shed some light on this? Thanks!

Attached some stats, and let me know if I need to post other logs.

kubectl describe pvc

Name:          storage-elasticsearch-logging-v1-0
Namespace:     kube-system
StorageClass:  standard
Status:        Bound
Volume:        pvc-96453dd3-36c9-11e8-9f27-029b836b1aaa
Labels:        k8s-app=elasticsearch-logging
Finalizers:    []
Capacity:      2Gi
Access Modes:  RWO
Events:        <none>

kubectl describe pv

Name:            pvc-a1825ec9-36c9-11e8-9f27-029b836b1aaa
StorageClass:    standard
Status:          Bound
Claim:           kube-system/storage-elasticsearch-logging-v1-1
Reclaim Policy:  Retain
Access Modes:    RWO
Capacity:        2Gi
    Type:       AWSElasticBlockStore (a Persistent Disk resource in AWS)
    VolumeID:   aws://us-west-2a/vol-01aa1c6a2ad2eae3a
    FSType:     ext4
    Partition:  0
    ReadOnly:   false
Events:         <none>

kubectl describe sc standard

Name:            standard
IsDefaultClass:  No
Annotations:     <none>
Parameters:      type=gp2
ReclaimPolicy:   Retain
Events:          <none>

Elasticsearch keeps its data in the configured data directories. It seems likely that isn't pointing to the persistent disk, so it's writing its data somewhere else that is lost when you shut the container down.

Thanks David! Indeed that was the case, as we also figured the ES data is stored in "/usr/share/elasticsearch" while we were mounting "/data" folder.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.