# Resize disk of a stateful set

**URL:** <https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [February 18, 2020, 10:33am UTC](https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758 "2020-02-18T10:33:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dg\_hivebrite](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dg_hivebrite/32/46359_2.png) [@dg\_hivebrite](https://discuss.elastic.co/u/dg_hivebrite)\
**Post date:** [February 18, 2020, 10:33am UTC](https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758/1 "2020-02-18T10:33:26Z")

</div>

Hi,

I have a cluster and I want to resize disks in my cluster.  
The storage class is "ssd" a custom storage class name with the following definition:

> ```
> allowVolumeExpansion: true
> apiVersion: storage.k8s.io/v1
> kind: StorageClass
> metadata:
> creationTimestamp: "2019-12-17T09:16:59Z"
> name: ssd
> resourceVersion: "17946775"
> selfLink: /apis/storage.k8s.io/v1/storageclasses/ssd
> uid: fa981893-20ad-11ea-bc1e-4201c0a80008
> parameters:
> type: pd-ssd
> provisioner: kubernetes.io/gce-pd
> reclaimPolicy: Delete
> volumeBindingMode: Immediate
> 
> ```

So with this storage class I enabled the resize of my volume.  
When I try to resize the volume the operator doesn't resize the disk

> ```
> {
> "level":"error",
> "@timestamp":"2020-02-18T10:27:53.573Z",
> "logger":"controller-runtime.controller",
> "message":"Reconciler error",
> "ver":"1.0.0-beta1-84792e30",
> "controller":"elasticsearch-controller",
> "request":"default/elk-jaeger-datastore",
> "error":"StatefulSet.apps \"elk-jaeger-datastore-es-all-europe-west1-a\" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden",
> "errorCauses":[
> {
> "error":"StatefulSet.apps \"elk-jaeger-datastore-es-all-europe-west1-a\" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden"
> }
> ],
> "stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.2.1/pkg/internal/controller/controller.go:218\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.2.1/pkg/internal/controller/controller.go:192\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.2.1/pkg/internal/controller/controller.go:171\nk8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190404173353-6a84e37a896d/pkg/util/wait/wait.go:152\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190404173353-6a84e37a896d/pkg/util/wait/wait.go:153\nk8s.io/apimachinery/pkg/util/wait.Until\n\t/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190404173353-6a84e37a896d/pkg/util/wait/wait.go:88"
> }
> 
> ```

So I would like to know if there is a way to resize the disk or a feature in progress ?  
If not how can I resize my cluster without dropping my cluster ? ( Adding new pods with the new size then waiting the data migration and delete step by step old pods ?)

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [February 18, 2020, 10:48am UTC](https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758/2 "2020-02-18T10:48:28Z")

</div>

Currently there is no easy way to resize existing volumes. See [this doc on limitations](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-orchestration.html#k8s-orchestration-limitations). [Here is the issue](https://github.com/elastic/cloud-on-k8s/issues/325) you can watch.

The easier workaround is to rename your existing NodeSets in the Elasticsearch specification and give them a different size at the same time.

For example, if you have a NodeSet named "all-europe-west-1a" which specifies 100GB volumes, you can rename that to "all-europe-west-1a-resized", change the volume specification to 150GB, then apply the manifest.  
ECK will take care of adding new nodes in "all-europe-west-1a-resized", migrating data away from nodes in "all-europe-west-1a", then remove those nodes.  
It might take some time depending on how much data you have there, but at least it's safe and simple.

---

<div class="post-metadata">

**Author:** ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)\
**Post date:** [February 18, 2020, 1:04pm UTC](https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758/3 "2020-02-18T13:04:33Z")

</div>

Not sure about gce-pd provisioner, but we have similar setup where ES is scaled as STS and disk was mounted from hostpath. We have extended the disk size for all the nodes in the cluster to double the size without any issues (using option provided in AWS console).

---

<div class="post-metadata">

**Author:** ![dg\_hivebrite](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dg_hivebrite/32/46359_2.png) [@dg\_hivebrite](https://discuss.elastic.co/u/dg_hivebrite)\
**Post date:** [February 18, 2020, 1:39pm UTC](https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758/4 "2020-02-18T13:39:38Z")

</div>

Ok, I see thank you for the information.  
So we have to wait kubernetes give us a better support for disk resizing if I correctly understand ?  
But it's a litle weird if the cloud provider give a feature to resize disk ...  
It would be very nice to have the support for resize volume.

@Ayush_Mathur you are using the EKS service or custom kubernetes ?

---

<div class="post-metadata">

**Author:** ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)\
**Post date:** [February 18, 2020, 3:59pm UTC](https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758/5 "2020-02-18T15:59:17Z")

</div>

Well, I guess it should work for both. The essential part here is, ES nodes were provided hostpath mounted directory, which is essentially as EBS volume created and attached to EC2 instances. Hence for any disk operations, i.e. shrinking or extending, can be done via cloud provider's console (AWS in our case).  
We are not using EKS, so can't provide any details about that, sorry.

---

<div class="post-metadata">

**Author:** ![acaldwell](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@acaldwell](https://discuss.elastic.co/u/acaldwell)\
**Post date:** [March 2, 2021, 2:54pm UTC](https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758/6 "2021-03-02T14:54:00Z")

</div>

late to the party, but FWIW you can resize the volume manually outside of kubernetes (we use Pure, for example and resized inside the Pure flashblade manager). The stack will pick up the change fairly quickly without restarting containers.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 7:45am UTC](https://discuss.elastic.co/t/resize-disk-of-a-stateful-set/219758/7 "2022-11-04T07:45:27Z")

</div>


