<p>I have an elasticsearch cluster that has the <code>storage</code> field set to 10Gi, I want to resize this cluster (for testing purposes to 15Gi). However, after changing the <code>storage</code> value from 10Gi to 15Gi I can see that the cluster still did not resize and the generated PVC is still set to 10Gi.</p>
<p>From what I can tell the aws-ebs storage  <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/storage-classes/</a> allows for volume expansion when the field <code>allowVolumeExpansion</code> is true. But even when I have this, the volume is never expanded when I change that <code>storage</code> value</p>
<pre><code>---
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
---
</code></pre>

Kay
<p>Technically it should work but your Kubernetes cluster might not be able to connect to the AWS API to expand the volume. Did you check the actual EBS volume on the EC2 console or AWS CLI? You can debug this issue by looking at the <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/" rel="nofollow noreferrer">kube-controller-manager</a> and <a href="https://kubernetes.io/docs/concepts/architecture/cloud-controller/" rel="nofollow noreferrer">cloud-controller manager</a> logs.</p>
<p>My guess is that there is some type of permission issue that from your K8s cluster that cannot talk to your AWS/EC2 API.</p>
<p>If you are running EKS, make sure that the IAM cluster role that you are using has permissions for EC2/EBS. You can check the <a href="https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html" rel="nofollow noreferrer">control plane logs</a> (kube-controller-manager, kube-apiserver, cloud-controller-manager, etc) on CloudWatch.</p>
<p>EDIT:</p>
<p>The <a href="https://www.elastic.co/guide/en/cloud-on-k8s/1.1/k8s-orchestration.html#k8s-orchestration-limitations" rel="nofollow noreferrer">Elasticsearch operator</a> uses <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">StatefulSets</a> and as of this date Volume expansion <a href="https://github.com/kubernetes/enhancements/issues/661" rel="nofollow noreferrer">is not supported</a> on StatefulSets.</p>
