elastic / elastic/cloud-on-k8s
Simplify how multiple volumes can be used for Elasticsearch path.data
- Dominant language
- Go
- Stars
- 2.8k
- Forks
- 790
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 37
Description
https://discuss.elastic.co/t/how-to-define-multiple-path-data-pointing-to-separate-volumes-or-pvc-using-eck/218644 raises the question of providing multiple volumes to `path.data`.
I think this is a valid use case when users are limited by the maximum size of their available volumes. Or want to use several physical disks.
Currently it's pretty tricky to correctly set things up. Here is a manifest that allows a multi-volumes setup:
```yaml
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: multi-volumes
spec:
version: 7.6.0
nodeSets:
- name: default
count: 3
config:
node.master: true
node.data: true
node.ingest: true
node.store.allow_mmap: false
podTemplate:
spec:
containers:
- name: elasticsearch
env:
- name: path.data
value: "/mnt/data,/mnt/data2,/mnt/data3"
volumeMounts:
- name: elasticsearch-data
mountPath: /mnt/data
- name: elasticsearch-data2
mountPath: /mnt/data2
- name: elasticsearch-data3
mountPath: /mnt/data3
initContainers:
- name: chown-data-volumes
command: ["sh", "-c", "chown elasticsearch:elasticsearch /mnt/data && chown elasticsearch:elasticsearch /mnt/data2 && chown elasticsearch:elasticsearch /mnt/data3"]
volumeClaimTemplates:
- metadata:
name: elasticsearch-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: standard
- metadata:
name: elasticsearch-data2
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: standard
- metadata:
name: elasticsearch-data3
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: standard
```
Relates https://github.com/elastic/cloud-on-k8s/issues/2574 & https://github.com/elastic/cloud-on-k8s/issues/2573.
Is there a way we could simplify things?
Idea:
We already rely on an "implicit" convention that the data volume must be named `elasticsearch-data`. If several `elasticsearch-data*` claims are setup in the `volumeClaimTemplates`, we could automatically generate the other bits, including:
- the `path.data` config
- the volume mounts
- the init container `chown` command
Contributor guide
Research direction
Start by tracing how Elasticsearch nodeSets process volumeClaimTemplates, pod volume mounts, path.data, and data-volume ownership. Review the related issues 2573 and 2574 and the multi-volume manifest in this issue. Done means supported elasticsearch-data* claims automatically produce the matching path.data configuration, mounts, and ownership setup without manual pod customization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, go, kubernetes
- Domain
- databases, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100