Hi ELK experts,
I have 3 node Elasticsearch(7.3.0) setup running on 3 separate hosts successfully. Now, I needed to scale down the hosts and run the same 3 nodes on 2 hosts. I am trying to use a configmap to set the podaffinity rule to use 'preferredDuringSchedulingIgnoredDuringExecution' with necessary labelselector. It was set to 'requriedDuringSchedulingIgnoredDuringExecution".
My deployment uses statefulset mechanism.
- Can I use configmap to change this configmap to change this setting and restart the pods?
- What's the correct syntax to specify the affinity or anti-affinity rule in configmap?
Current configuration in statefulset.
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- "elasticsearch-master"
topologyKey: kubernetes.io/hostname
My configmap looks something like this, where I need to add the modified affinity rule.
apiVersion: v1
kind: ConfigMap
metadata:
name: elasticsearch-master-config
namespace: stage
data:
elasticsearch.yml: |
cluster:
name: elasticsearch
node:
master: true
data: true
ingest: true
network.host: 0.0.0.0
indices:
query:
bool:
max_clause_count: 2000
xpack:
security:
enabled: false
http:
max_header_size: "16kb"
cors:
enabled: true
allow-origin: "*"
allow-methods : "OPTIONS, HEAD, GET, POST, PUT, DELETE"
allow-headers : "X-Requested-With,X-Auth-Token,Content-Type, Content-Length X-CSRF-Token"
Appreciate any help.