Search code examples
elasticsearchkubernetesyamlbackup

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


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


Solution

  • 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"