How to edit a pvc claim size and record the change... Please share the command.. . . .

BISWAJIT DAS:
How to edit a pvc claim size and record the change… Please share the command… And the pvc yaml

Mohamed Ayman:
You can try with kubectl edit pvc pvc-name --record but only dynamically provisioned PVC can be resized and the storageclass that provisions the PVC must support resize.

Mohamed Ayman:
Regarding the resize of PVC which is associated with PV, you will need to delete the PVC then resize It and create It again.
OR use kubectl patch

Mohamed Ayman:
https://www.runlevl4.com/kubernetes/patching-kubernetes-resources#more-476

Neelesh Korade:
Hi @Mohamed Ayman I followed the steps in the link you have given but my PVC stays in pending state saying it’s waiting for the first consumer while the pod remains in containerCreating state saying the pvc used in volumes is not bound yet. Any idea what’s going wrong?

// storage class
k get sc
NAME      PROVISIONER                    RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
dynamic   <http://kubernetes.io/no-provisioner|kubernetes.io/no-provisioner>   Retain          WaitForFirstConsumer   true                   9m53s
// pv
k get pv dynamic-pv
NAME         CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS   REASON   AGE
dynamic-pv   500Mi      RWO            Retain           Available           dynamic                 7m14s
// pvc
 k describe  pvc dynamic-pvc
Name:          dynamic-pvc
Namespace:     default
StorageClass:  dynamic
Status:        Pending
Volume:        
Labels:        &lt;none&gt;
Annotations:   &lt;none&gt;
Finalizers:    [<http://kubernetes.io/pvc-protection|kubernetes.io/pvc-protection>]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    webapp
Events:
  Type    Reason                Age                  From                         Message
  ----    ------                ----                 ----                         -------
  Normal  WaitForFirstConsumer  1s (x23 over 5m27s)  persistentvolume-controller  waiting for first consumer to be created before binding
// pod
 k describe po webapp
Name:         webapp
Namespace:    default

Events:
  Type     Reason       Age                   From             Message
  ----     ------       ----                  ----             -------
  Warning  FailedMount  116s (x3 over 4m34s)  kubelet, node01  Unable to attach or mount volumes: unmounted volumes=[webapp], unattached volumes=[webapp default-token-l5rqk]: error processing PVC default/dynamic-pvc: PVC is not bound

Neelesh Korade:
I see, there’s a selector field in the PV. Never mind!

Neelesh Korade:
I am sorry, I still. have the issue. I fixed the selector field in the PV. After that, if the volumeBindingMode is set to Immediate , the pv-pvc bound well and the pod runs successfully. However, if the volumeBindingMode is set to waitForFirstConsumer , the pod doesn’t start saying pvc is not bound and the pvc does not bind saying waiting for the first consumer to be created before binding .