zalando-incubator / es-operator

Kubernetes Operator for Elasticsearch
353 stars 44 forks source link

Persistent data management #436

Open mabilinab opened 2 weeks ago

mabilinab commented 2 weeks ago

Hi there, I have found very little info on how the operator manages data. I have used volumeClaimTemplates to dynamically provision storage, however, I'm not quite sure of how the operator manages pvcs:

Does anyone have any tips or info on this? Thank you!

otrosien commented 2 weeks ago

Hello @mabilinab,

the thing is, ES-Operator doesn't actually manage any persistent volumes, it all gets delegated to the underlying StatefulSet. You should check the StatefulSet properties so that the volumeClaim gets removed (I'm not too deep into this).

Resizing is something not every Kubernetes installation supports, but you can find discussions with how-tos, for example here: https://serverfault.com/questions/955293/how-to-increase-disk-size-in-a-stateful-set

ES-Operator defaults to draining the node before termination, which is different from what the ECK does. If I'm not mistaken, ECK assumes persistent volumes and considers a temporary reduced availability of data being fine while the data node is supposed to come back online. When draining, the redistribution of data is delegated to Elasticsearch itself. It tries to keep a balanced shard-per-node ratio, based on a heuristic that can be tweaked, but they don't recommend you to do so: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-cluster.html#shards-rebalancing-heuristics

There are other constraints that will cause Elasticsearch not to colocate more shards onto the same node. Amongst them:

Hope this helps.