I have verified this on my GKE test cluster which supports Dynamic Provisioning. As I mentioned in comments, you are trying to edit spec
part of PersistentVolumeClaim which is immutable
, except resources.requests
.
However, storage
field path is spec.resources.requests.storage
and I do not have any issue with editing this. When you are using kubectl edit
as default it's using vi editor
which controls might be hard/it's easy for a typo. I guess you accidentally changed more than just storage
in your example (maybe typo in selectors
, labels
).
You can always use another editor like nano
.
KUBE_EDITOR="nano" kubectl edit pvc <pvc-name>
For test Ive used This YAML on GKE cluster.
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
mongodb-pv-claim Bound pvc-802714bf-3922-4b41-b70f-97394f252a00 10Gi RWO standard 16s
Instead of editing
resource you can also patch resources.
kubectl patch pvc <pvc-name> -p '{"spec":{"resources":{"requests":{"storage":"70Gi"}}}}'
$ kubectl patch pvc mongodb-pv-claim -p '{"spec":{"resources":{"requests":{"storage":"70Gi"}}}}}'
persistentvolumeclaim/mongodb-pv-claim patched
After that, if you will describe PVC
you can find information like below:
Conditions:
Type Status LastProbeTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
FileSystemResizePending True Mon, 01 Jan 0001 00:00:00 +0000 Fri, 25 Sep 2020 06:40:17 +0000 Waiting for user to (re-)start a pod to finish
file system resize of volume on node.
After while:
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
mongodb-pv-claim Bound pvc-802714bf-3922-4b41-b70f-97394f252a00 70Gi RWO standard 8m37s
Please keep in mind that as per error message, that it's wokring only for bound claims
.
If patch
or edit with nano
won't work for you, please provide your PVC
yaml.
EDIT
As per OP's comment below answer, creating storageclass
which supports Dynamic Provisioning resolved this issue.