Satyajit Das
Satyajit Das

Reputation: 2920

Does statefulset transfer data if restarted with higher volume?

I have a statefulset having 2 replicas and I want to increase the storage in each of the pods from 300GB to 3TB. So I edited the statefulset to increase the storage.

But this doesn't get reflected directly. I plan to do a rollout restart using the command of type:

kubectl rollout restart statefulset my-statefulset

But I am not sure if this will create Pods with fresh volume or if there is an easy way to ensure that it transfers the old data of 300GB to the volume of 3TB.

I am using GKE.

Client Version: v1.16.1

Server Version: v1.14.10-gke.42

Upvotes: 1

Views: 225

Answers (1)

Tarun Khosla
Tarun Khosla

Reputation: 1362

There is way expand volumes . Steps in brief

  1. Your storage class should have allowVolumeExpansion field to true and provisioner should support it (in case of GKE if your volumes are provisioned with provisioner: kubernetes.io/gce-pd this will work).
  2. Edit the storage in PVC ( remember you can only expand the volume and not shrink it)
  3. After you edit it will wait for pod restart for the expansion to take place. Once pod restarts it will expand the volume.

Reference Doc : here

Upvotes: 2

Related Questions