0

这是我的 Elasticsearch yaml:

---
# Source: elastic/templates/elastic.yaml
apiVersion: elasticsearch.k8s.elastic.co/v1 
kind: Elasticsearch 
metadata: 
  name: ichat-els-deployment
spec: 
  # updateStrategy:
  #   changeBudget:
  #     maxSurge: -1
  #     maxUnavailable: -1
  version: 7.11.1
  auth:
    roles:
    - secretName: elastic-roles-secret
    fileRealm:
    - secretName: elastic-filerealm-secret
  nodeSets: 
  - name: default
    count: 1 
    config:
      node.store.allow_mmap: false 
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        storageClassName: ""
        accessModes:
        - ReadWriteMany
        resources:
          requests:
            storage: 10Gi
        volumeName: elasticsearch-azure-pv
    podTemplate:
      spec:
        initContainers:
        - name: install-plugins
          command:
          - sh
          - -c
          - |
            bin/elasticsearch-plugin install --batch ingest-attachment
  - name: default2
    count: 0
    config:
      node.store.allow_mmap: false 
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi

创建后,我运行了 2 个节点集kubectl get pods

NAME                                 READY   STATUS    RESTARTS   AGE
elastic-operator-0                   1/1     Running   8          7d23h
ichat-els-deployment-es-default-0    1/1     Running   0          24m
ichat-els-deployment-es-default2-0   1/1     Running   0          26m

一切正常,但现在我想删除 default2 节点集,我该怎么做?我尝试从清单中删除节点集并重新应用它,但什么也没发生:

---
# Source: elastic/templates/elastic.yaml
apiVersion: elasticsearch.k8s.elastic.co/v1 
kind: Elasticsearch 
metadata: 
  name: ichat-els-deployment
spec: 
  # updateStrategy:
  #   changeBudget:
  #     maxSurge: -1
  #     maxUnavailable: -1
  version: 7.11.1
  auth:
    roles:
    - secretName: elastic-roles-secret
    fileRealm:
    - secretName: elastic-filerealm-secret
  nodeSets: 
  - name: default
    count: 1 
    config:
      node.store.allow_mmap: false 
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        storageClassName: ""
        accessModes:
        - ReadWriteMany
        resources:
          requests:
            storage: 10Gi
        volumeName: elasticsearch-azure-pv
    podTemplate:
      spec:
        initContainers:
        - name: install-plugins
          command:
          - sh
          - -c
          - |
            bin/elasticsearch-plugin install --batch ingest-attachment

pod 和 shards 仍在运行,并且弹性算子没有错误。删除节点集的正确方法是什么?谢谢。

4

0 回答 0