How can I edit elasticsearch.yml on kubernetes pods, with a statefulset, or something similar?

4/24/2019

I have to edit elasticsearch.yml in order to create a backup (setting the path.repo like this is necessary): path.repo: /mnt/backup

But I have elasticsearch running on Kubernetes, and I would like to set the path.repo from a statefulset or something similar to all pods at the same time. Can anyone tell me how to do that? Thanks

I tried to do this with configmap like this: https://discuss.elastic.co/t/modify-elastic-yml-file-in-kubernetes-pod/103612

but when I restarted the pod it threw an error: /usr/share/elasticsearch/bin/run.sh: line 28: ./config/elasticsearch.yml: Read-only file system

-- fbede
backup
elasticsearch
kubernetes
yaml

2 Answers

4/29/2019

I just realized, that you don't even have to edit elasticsearch.yml to set the path.repo setting, you can add it as an enviromental variable in your statefulset like this: env: - name: path.repo value: "/mnt/backup"

-- fbede
Source: StackOverflow

4/24/2019

ConfigMaps are mounted to pods as read-only filesystems, this behavior cannot be changed.

If you want to be able to modify config once for all pods then you have to mount config/ directory as a ReadWriteMany persistent volume (NFS, GlusterFS and so on).

-- Vasily Angapov
Source: StackOverflow