To test we create a sample k8s cluster, here using GCP: Before we move onto raising a PVC in a StatefulSet it might be nice to test this on a simple single pod first. This will result in: First we update the PVC (kubectl edit pvc pvc-one): Wait till kubectl describe pvc pvc-one shows that it’s waiting for a pod restart: Now delete and re-create the pod, after which the magic should be done: Let’s create a very simple example StatefulSet: Which results in: We patch the PVCs for faster than manual edit: Now wait till every PVC has the correct status: Then we have to restart each of the StatefulSet pods: If we stop here and only raise the PVC sizes but not the StatefulSet volumeClaimTemplate, then scaling up the StatefulSet would result in new pods having PVCs with wrong sizes. So we update the StatefulSet in our local YAML file: Now we delete the StatefulSet without deleting the pods for low impact. Then we create the StatefulSet again: In future k8s versions, we might be able to update the volumeClaimTemplates of a running StatefulSet.
3 years ago we started our Medium blog & now we take the next step to unite our community.