runlevl4:
@Kubs This should get you but I don’t have a dynamic pvc to test with at the moment: k patch pvc <pvc-name> -p '{"spec":{"resources":{"requests":{"storage":"<new-size>"}}}}'
Kubs:
If we use the below storage class, is that going to work
Kubs:
apiVersion: <http://storage.k8s.io/v1|storage.k8s.io/v1>
kind: StorageClass
metadata:
name: fast
provisioner: <http://kubernetes.io/gce-pd|kubernetes.io/gce-pd>
parameters:
type: pd-ssd
runlevl4:
I believe it’d need the dynamic provisioner:
gce-pd-dynamic-provisioner
I’m not a Google Cloud dude, though, so don’t quote me on it.
Kubs:
Thanks
maheshwar reddy:
What if we dod kubectl edit pvc?
runlevl4:
You can edit a pvc that way too.
runlevl4:
@Kubs I confirmed that patch command works with a dynamic sc.
$ k patch pvc delayed-pvc -p '{"spec":{"resources":{"requests":{"storage":"200Mi"}}}}'
persistentvolumeclaim/delayed-pvc patched
$ k patch pvc delayed-pvc -p '{"spec":{"resources":{"requests":{"storage":"250Mi"}}}}' --record=true
persistentvolumeclaim/delayed-pvc patched
runlevl4:
FYI, if you need to prove that it was resized, you need to include the --record
flag. To demonstrate how this works, I increased the PVC to 275Mi after patching to 250. When you use the flag, an annotation gets added which can be seen with a describe
.
Annotations: <http://kubernetes.io/change-cause|kubernetes.io/change-cause>: kubectl patch pvc delayed-pvc --patch={"spec":{"resources":{"requests":{"storage":"250Mi"}}}} --record=true
Note, however, that even though I successfully patched again, I didn’t include the flag. The previous annotation remains, and my patch was implemented but not recorded.
$ k patch pvc delayed-pvc -p '{"spec":{"resources":{"requests":{"storage":"275Mi"}}}}'
persistentvolumeclaim/delayed-pvc patched
$ k describe pvc delayed-pvc
...
Annotations: <http://kubernetes.io/change-cause|kubernetes.io/change-cause>: kubectl patch pvc delayed-pvc --patch={"spec":{"resources":{"requests":{"storage":"250Mi"}}}} --record=true