我有一个Elasticsearch集群,其storage字段设置为10Gi,我想调整此集群的大小(出于测试目的,设置为15Gi)。但是,将storage值从10Gi更改为15Gi后,我可以看到群集仍未调整大小,并且生成的PVC仍设置为10Gi。
据我所知,aws-ebs存储https://kubernetes.io/docs/concepts/storage/storage-classes/允许在字段allowVolumeExpansion为true时进行卷扩展。但是即使有了这个,更改storage值也不会扩大音量

---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: elasticsearch-storage
  namespace: test
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
reclaimPolicy: Delete
allowVolumeExpansion: true
---
apiVersion: elasticsearch.k8s.elastic.co/v1beta1
kind: Elasticsearch
metadata:
  name: elasticsearch
  namespace: test
spec:
  version: 7.4.2
  spec:
    http:
      tls:
        certificate:
          secretName: es-cert
  nodeSets:
  - name: default
    count: 3
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
        annotations:
          volume.beta.kubernetes.io/storage-class: elasticsearch-storage
      spec:
        accessModes:
        - ReadWriteOnce
        storageClassName: elasticsearch-storage
        resources:
          requests:
            storage: 15Gi
    config:
      node.master: true
      node.data: true
      node.ingest: true
      node.store.allow_mmap: false
      xpack.security.authc.realms:
        native:
          native1:
            order: 1
---

最佳答案

从技术上讲,它应该可以工作,但是您的Kubernetes集群可能无法连接到AWS API来扩展卷。您是否在EC2控制台或AWS CLI上检查了实际的EBS量?您可以通过查看kube-controller-managercloud-controller manager日志来调试此问题。
我的猜测是,您的K8s集群存在某种类型的权限问题,无法与您的AWS / EC2 API进行通信。
如果您正在运行EKS,请确保所使用的IAM群集角色具有EC2 / EBS的权限。您可以在CloudWatch上检查control plane logs(kube-controller-manager,kube-apiserver,cloud-controller-manager等)。
编辑:
Elasticsearch operator使用StatefulSets,截至该日期为止,StatefulSets上的卷扩展为is not supported

09-10 09:08
查看更多