pires / kubernetes-elasticsearch-cluster

Elasticsearch cluster on top of Kubernetes made easy.
Apache License 2.0
1.51k stars 690 forks source link

Add anti-affinity to avoid scheduling multiple ES pods onto the same nodes #191

Closed rocketraman closed 6 years ago

rocketraman commented 6 years ago

Specs, especially master and data deployments and stateful sets, should probably include a pod anti-affinity configuration, to avoid scheduling multiple pods onto the same nodes. For example:

      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: "component"
                    operator: In
                    values:
                    - "elasticsearch"
                  - key: "role"
                    operator: In
                    values:
                    - "data"
              topologyKey: "kubernetes.io/hostname"
pires commented 6 years ago

As documented in https://github.com/pires/kubernetes-elasticsearch-cluster#pod-anti-affinity?

pires commented 6 years ago

You do have a point in adding key component. Please, do open a PR. Happy to review :)