如何在kubernetes pod上编辑elasticsearch.yml,使用statefulset或类似的东西?

问题描述 投票:0回答:2

我必须编辑elasticsearch.yml才能创建备份(设置path.repo就像这样是必要的):path.repo: /mnt/backup

但我在Kubernetes上运行了弹性搜索,我想同时将state.repo设置为statefulset或类似于所有pod的东西。谁能告诉我怎么做?谢谢

我尝试使用这样的configmap执行此操作:https://discuss.elastic.co/t/modify-elastic-yml-file-in-kubernetes-pod/103612

但当我重新启动pod时,它抛出了一个错误:/usr/share/elasticsearch/bin/run.sh: line 28: ./config/elasticsearch.yml: Read-only file system

elasticsearch kubernetes yaml backup
2个回答
1
投票

ConfigMaps作为只读文件系统挂载到pod,此行为无法更改。

如果您希望能够为所有pod修改配置一次,则必须将config /目录挂载为ReadWriteMany持久卷(NFS,GlusterFS等)。


0
投票

我刚才意识到,你甚至不需要编辑elasticsearch.yml来设置path.repo设置,你可以在你的statefulset中将它添加为环境变量,如下所示:env: - name:path.repo value:“/ MNT /备份”

© www.soinside.com 2019 - 2024. All rights reserved.