Create Coordinate nodes on existing cluster on Kubernetes

We want to add coordinate nodes to increase the performance. We have tried adding role : {} along with pod-affinity : {} but it doesn't create the coordinate nodes and marking yaml invalid.

3 master and 3 data nodes are working perfectly. We want to add 2 coordinate nodes.

Current state of Cluster:

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: test
  labels:
    component: elasticsearch
    role: cluster
    tier: backends
  namespace: dev-backend
spec:
  version: 7.4.2
  http:
    service:
      spec:
        type: LoadBalancer
      metadata:
        name: elasticsearch
        annotations:
          cloud.google.com/load-balancer-type: "Internal"
  nodeSets:
    - name: masters
      count: 3
      config:
        node.master: true
        node.data: false
        node.ingest: false
        node.ml: false
      podTemplate:
        metadata:
          labels:
            component: elasticsearch
            role: master
            tier: backends
        spec:
          affinity:
            podAntiAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                - labelSelector:
                    matchExpressions:
                      - key: elasticsearch.k8s.elastic.co/statefulset-name
                        operator: In
                        values:
                          - test-es-master
                  topologyKey: kubernetes.io/hostname
          initContainers:
            - name: increase-vm-max-map
              image: busybox
              command: ["sysctl", "-w", "vm.max_map_count=262144"]
              securityContext:
                privileged: true
            - name: increase-fd-ulimit
              image: busybox
              command: ["sh", "-c", "ulimit -n 100000"]
              securityContext:
                privileged: true
          containers:
            - name: elasticsearch
              resources:
                requests:
                  memory: 2Gi
                  cpu: 35m
              env:
                - name: ES_JAVA_OPTS
                  value: "-Xms1g -Xmx1g"
          volumes:
            - name: elasticsearch-data
              emptyDir: {}
          nodeSelector:
            pool: backend
    - name: data
      count: 3
      config:
        node.master: false
        node.data: true
        node.ingest: true
        node.ml: false
      volumeClaimTemplates:
        - metadata:
            name: elasticsearch-data
            annotations:
              volume.beta.kubernetes.io/storage-class: "standard"
          spec:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 50Gi
            storageClassName: standard
      podTemplate:
        metadata:
          labels:
            component: elasticsearch
            role: data
            tier: backends
        spec:
          affinity:
            podAntiAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                - labelSelector:
                    matchExpressions:
                      - key: elasticsearch.k8s.elastic.co/statefulset-name
                        operator: In
                        values:
                        - test-es-data
                  topologyKey: kubernetes.io/hostname
          initContainers:
            - name: increase-vm-max-map
              image: busybox
              command: ["sysctl", "-w", "vm.max_map_count=262144"]
              securityContext:
                privileged: true
            - name: increase-fd-ulimit
              image: busybox
              command: ["sh", "-c", "ulimit -n 500000"]
              securityContext:
                privileged: true
          containers:
            - name: elasticsearch
              resources:
                requests:
                  memory: 6Gi
                  cpu: 137m
              env:
                - name: ES_JAVA_OPTS
                  value: "-Xms3g -Xmx3g"
          nodeSelector:
            pool: backend

I tried adding following nodeset for adding coordinate nodes but this results in invalid yaml:

    - name: http
      count: 2
      config:
        node.master: false
        node.data: false
        node.ingest: false
        node.ml: false
      podTemplate:
        metadata:
          labels:
            component: elasticsearch
            role: {}
            tier: backends
        spec:
          affinity: {}
          initContainers:
            - name: increase-vm-max-map
              image: busybox
              command: ["sysctl", "-w", "vm.max_map_count=262144"]
              securityContext:
                privileged: true
            - name: increase-fd-ulimit
              image: busybox
              command: ["sh", "-c", "ulimit -n 100000"]
              securityContext:
                privileged: true
          containers:
            - name: elasticsearch
              resources:
                requests:
                  memory: 2Gi
                  cpu: 35m
              env:
                - name: ES_JAVA_OPTS
                  value: "-Xms1g -Xmx1g"
          volumes:
            - name: elasticsearch-data
              emptyDir: {}
          nodeSelector:
            pool: backend

Elasticsearch version is 7.4.2
opeartor version: docker.elastic.co/eck/eck-operator:1.2.1
kubernetes version: 1.21.6-gke.1503
Platform: GKE

Can you please help with the exact values to be used to add coordinate nodes to existing cluster?

Can anyone please look into this? It would be great help :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.