How can i stop a cluster on ECK

I changed the cluster yaml file nodeSet.config.count value to 0 In my cluster,When i kubectl describe es xxxx_es_id ,the logs info is:"es26f861-fa5d-410a-acb1-b9281f6814ae" is invalid: spec.nodeSets: Required value: Elasticsearch needs to have at least one master node。
How do I skip this limit,pls

What are you trying to achieve? Can you share your YAML manifest maybe. A cluster with 0 nodes is effectively scaled down so you might as well delete the Elasticsearch cluster all together. The only exception to that rule is when you have autoscaling setup in which case we allow zero-sized nodeSets (as the autoscaler will adjust the count)

1 Like

Thanks for reply!
I just want to stop my cluster instead of deleting it, just to temporarily free up resources, next time I can continue to start, but I found that it does not allow me to do so, just like the error mentioned before, I will try you to The scheme, thank you. Following is my yaml file:

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  annotations:
    common.k8s.elastic.co/controller-version: 1.6.0
    elasticsearch.k8s.elastic.co/cluster-uuid: ue9VmPYSSFek_4s04vVq1A
  creationTimestamp: "2021-09-02T11:16:47Z"
  generation: 1
  name: es48fe28-6265-40ef-88db-6657a7380774
  namespace: my-eck-test
  resourceVersion: "23638597"
  selfLink: /apis/elasticsearch.k8s.elastic.co/v1/namespaces/my-eck-test/elasticsearches/es48fe28-6265-40ef-88db-6657a7380774
  uid: 433e306f-0bdf-11ec-95f5-5254f60d511e
spec:
  auth:
    fileRealm:
    - secretName: es48fe28-6265-40ef-88db-6657a7380774
  http:
    service:
      metadata:
        creationTimestamp: null
      spec: {}
    tls:
      certificate: {}
  image: hub.mysite.com/elasticsearch/elasticsearch:7.12.0
  nodeSets:
  - config:
      http.cors.allow-credentials: "true"
      http.cors.allow-headers: X-Requested-With,Content-Type,Content-Length
      http.cors.allow-methods: OPTIONS,HEAD,GET,POST,PUT,DELETE
      http.cors.allow-origin: '*'
      http.cors.enabled: "true"
      http.cors.max-age: "1728000"
      http.max_content_length: 100mb
      node.roles:
      - master
      node.store.allow_mmap: false
      transport.tcp.compress: "true"
    count: 3
    name: m-20
    podTemplate:
      metadata:
        creationTimestamp: null
        labels:
          elasticsearch.k8s.elastic.co/pod-role-name: m
      spec:
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
              - matchExpressions:
                - key: kubernetes.io/hostname
                  operator: NotIn
                  values:
                  - master
        containers:
        - env:
          - name: TZ
            value: Asia/Shanghai
          - name: ES_JAVA_OPTS
            value: -Xms1g -Xmx1g
          lifecycle:
            postStart:
              exec:
                command:
                - bash
                - -c
                - /usr/share/elasticsearch/shell/s3_add_key.sh
          name: elasticsearch
          resources:
            limits:
              cpu: "1"
              memory: 3Gi
          volumeMounts:
          - mountPath: /usr/share/elasticsearch/data
            name: es-data
        initContainers:
        - command:
          - sh
          - -c
          - sysctl -w vm.max_map_count=262144
          name: set-max-map-count
          resources: {}
          securityContext:
            privileged: true
        - command:
          - sh
          - -c
          - bin/elasticsearch-plugin install --batch repository-s3 || true
          name: install-plugins-s3
          resources: {}
    volumeClaimTemplates:
    - metadata:
        creationTimestamp: null
        name: es-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
        storageClassName: managed-nfs-storage
      status: {}
    - metadata:
        creationTimestamp: null
        name: es-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
        storageClassName: managed-nfs-storage
      status: {}
    - metadata:
        creationTimestamp: null
        name: es-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
        storageClassName: managed-nfs-storage
      status: {}
  - config:
      http.cors.allow-credentials: "true"
      http.cors.allow-headers: X-Requested-With,Content-Type,Content-Length
      http.cors.allow-methods: OPTIONS,HEAD,GET,POST,PUT,DELETE
      http.cors.allow-origin: '*'
      http.cors.enabled: "true"
      http.cors.max-age: "1728000"
      http.max_content_length: 100mb
      node.roles:
      - data
      node.store.allow_mmap: false
      transport.tcp.compress: "true"
    count: 1
    name: d-20
    podTemplate:
      metadata:
        creationTimestamp: null
        labels:
          elasticsearch.k8s.elastic.co/pod-role-name: d
      spec:
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
              - matchExpressions:
                - key: kubernetes.io/hostname
                  operator: NotIn
                  values:
                  - master
        containers:
        - env:
          - name: TZ
            value: Asia/Shanghai
          - name: ES_JAVA_OPTS
            value: -Xms1g -Xmx1g
          lifecycle:
            postStart:
              exec:
                command:
                - bash
                - -c
                - /usr/share/elasticsearch/shell/s3_add_key.sh
          name: elasticsearch
          resources:
            limits:
              cpu: "1"
              memory: 3Gi
          volumeMounts:
          - mountPath: /usr/share/elasticsearch/data
            name: es-data
        initContainers:
        - command:
          - sh
          - -c
          - sysctl -w vm.max_map_count=262144
          name: set-max-map-count
          resources: {}
          securityContext:
            privileged: true
        - command:
          - sh
          - -c
          - bin/elasticsearch-plugin install --batch repository-s3 || true
          name: install-plugins-s3
          resources: {}
    volumeClaimTemplates:
    - metadata:
        creationTimestamp: null
        name: es-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
        storageClassName: managed-nfs-storage
      status: {}
  - config:
      http.cors.allow-credentials: "true"
      http.cors.allow-headers: X-Requested-With,Content-Type,Content-Length
      http.cors.allow-methods: OPTIONS,HEAD,GET,POST,PUT,DELETE
      http.cors.allow-origin: '*'
      http.cors.enabled: "true"
      http.cors.max-age: "1728000"
      http.max_content_length: 100mb
      node.roles:
      - ingest
      node.store.allow_mmap: false
      transport.tcp.compress: "true"
    count: 1
    name: c-20
    podTemplate:
      metadata:
        creationTimestamp: null
        labels:
          elasticsearch.k8s.elastic.co/pod-role-name: c
      spec:
        affinity:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
              - matchExpressions:
                - key: kubernetes.io/hostname
                  operator: NotIn
                  values:
                  - master
        containers:
        - env:
          - name: TZ
            value: Asia/Shanghai
          - name: ES_JAVA_OPTS
            value: -Xms1g -Xmx1g
          lifecycle:
            postStart:
              exec:
                command:
                - bash
                - -c
                - /usr/share/elasticsearch/shell/s3_add_key.sh
          name: elasticsearch
          resources:
            limits:
              cpu: "1"
              memory: 3Gi
          volumeMounts:
          - mountPath: /usr/share/elasticsearch/data
            name: es-data
        initContainers:
        - command:
          - sh
          - -c
          - sysctl -w vm.max_map_count=262144
          name: set-max-map-count
          resources: {}
          securityContext:
            privileged: true
        - command:
          - sh
          - -c
          - bin/elasticsearch-plugin install --batch repository-s3 || true
          name: install-plugins-s3
          resources: {}
    volumeClaimTemplates:
    - metadata:
        creationTimestamp: null
        name: es-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
        storageClassName: managed-nfs-storage
      status: {}
  podDisruptionBudget:
    metadata:
      creationTimestamp: null
    spec: {}
  transport:
    service:
      metadata:
        creationTimestamp: null
      spec: {}
    tls:
      certificate: {}
  updateStrategy:
    changeBudget:
      maxUnavailable: -1
  version: 7.12.0
status:
  availableNodes: 5
  health: green
  phase: Ready
  version: 7.12.0

Hi,can you help me?

Hey @w_Aaron,

as @pebrc mentioned above, we don't allow scaling down to 0. The next best thing you can do is to delete the cluster altogether (eg. kubectl delete es -n my-eck-test es48fe28-6265-40ef-88db-6657a7380774).

Let me know if you have any questions.

Thanks,
David

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