Volume claim templatesedit

Specifying the volume claim settingsedit

By default, the operator creates a PersistentVolumeClaim with a capacity of 1Gi for each pod in an Elasticsearch cluster to prevent data loss in case of accidental pod deletion. For production workloads, you should define your own volume claim template with the desired storage capacity and (optionally) the Kubernetes storage class to associate with the persistent volume. The name of the volume claim must always be elasticsearch-data.

  - name: default
    count: 3
    - metadata:
        name: elasticsearch-data
        - ReadWriteOnce
            storage: 5Gi
        storageClassName: standard

Controlling volume claim deletionedit

ECK automatically deletes PersistentVolumeClaim resources if the owning Elasticsearch nodes are scaled down. The corresponding PersistentVolumes may be preserved, depending on the configured storage class reclaim policy.

In addition, you can control what ECK should do with the PersistentVolumeClaims if you delete the Elasticsearch cluster altogether through the volumeClaimDeletePolicy attribute.

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
  name: es
  version: 7.12.1
  volumeClaimDeletePolicy: DeleteOnScaledownOnly
  - name: default
    count: 3

The possible values are DeleteOnScaledownAndClusterDeletion and DeleteOnScaledownOnly. By default DeleteOnScaledownAndClusterDeletion is in effect, which means that all PersistentVolumeClaims are deleted together with the Elasticsearch cluster. However, DeleteOnScaledownOnly keeps the PersistentVolumeClaims when deleting the Elasticsearch cluster. If you recreate a deleted cluster with the same name and node sets as before, the existing PersistentVolumeClaims will be adopted by the new cluster.

Updating the volume claim settingsedit

If the storage class allows volume expansion, you can increase the storage requests size in the volumeClaimTemplates. ECK will update the existing PersistentVolumeClaims accordingly, and recreate the StatefulSet automatically. If the volume driver supports ExpandInUsePersistentVolumes, the filesystem is resized online, without the need of restarting the Elasticsearch process, or re-creating the Pods. If the volume driver does not support ExpandInUsePersistentVolumes, Pods must be manually deleted after the resize, to be recreated automatically with the expanded filesystem.

Any other changes are forbidden in the volumeClaimTemplates, such as changing the storage class or decreasing the volume size. To make these changes, you can create a new nodeSet with different settings, and remove the existing nodeSet. In practice, that’s equivalent to renaming the existing nodeSet while modifying its claim settings in a single update. Before removing Pods of the deleted nodeSet, ECK makes sure that data is migrated to other nodes.


Don’t use emptyDir as it might generate permanent data loss.

If you are not concerned about data loss, you can use an emptyDir volume for Elasticsearch data:

  - name: data
    count: 10
        - name: elasticsearch-data
          emptyDir: {}