为了更改/usr/share/elasticsearch/data/nodes
目录的所有者,您必须创建一个initContainer
将更改权限的目录。
您可以通过获取 elasticsearch 图表来做到这一点:
helm fetch --untar elasticsearch elastic/elasticsearch
然后更改values.yaml
并添加以下行:
antiAffinity: "soft"
# Shrink default JVM heap.
esJavaOpts: "-Xmx128m -Xms128m"
# Allocate smaller chunks of memory per pod.
resources:
requests:
cpu: "100m"
memory: "512M"
limits:
cpu: "1000m"
memory: "512M"
# Request smaller persistent volumes.
volumeClaimTemplate:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "hostpath"
resources:
requests:
storage: 100M
extraInitContainers: |
- name: create
image: busybox:1.28
command: ['mkdir', '/usr/share/elasticsearch/data/nodes/']
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-master
- name: file-permissions
image: busybox:1.28
command: ['chown', '-R', '1000:1000', '/usr/share/elasticsearch/']
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-master
它更改 pod 的 cpu 和内存请求以及限制,并从更改目录权限initContainer
的chown', '-R', '1000:1000', '/usr/share/elasticsearch/'
命令开始。