Search code examples
kubernetespersistent-volumeskubernetes-pvc

PVC status is stuck on pending and PV status is available


I was trying to increase the PVC size from 10G to 20G, since we are running on 1.9.3 doing it online is not there. So i have deleted the PVC and created with new value of 20G as storage.

pvc-b196868cd-bc75-12e8-ad32-075738325c   100Gi      RWO            Retain           Released    myapp/myapp-backup-pv-claim`                                persistent                   4m

As i deleted, the PV status turned on to "Released" and when i tried to recreate the PVC the it got created but with the status "lost"

myapp-myapp-backup-pv-claim                 Lost      pvc-03b34iknca1-6fr3-19ea-af3b-0073yh2u97f   0                         ntfts19-k8s-0101   13m

We are using the Vsphere volumes. Tried the solution of "kubectl patch pv pv-for-rabbitmq -p '{"spec":{"claimRef": null}}'" this helped me to bring back the pv in "Available" status, now the PVC is in stuck with "Pending" state.

pvc-b196868cd-bc75-12e8-ad32-075738325c   100Gi      RWO            Retain           Available    myapp/myapp-backup-pv-claim`                                persistent                   2m

myapp-myapp-backup-pv-claim                 Pending      pvc-03b34iknca1-6fr3-19ea-af3b-0073yh2u97f   0                         ntfts19-k8s-0101   28m 

PV Describe:

Name:          myapp-myapp-backup-pv-claim   
Namespace:     myapp
StorageClass:  ntfts19-k8s-0101 
Status:        Pending
Volume:        pvc-03b34iknca1-6fr3-19ea-af3b-0073yh2u97f 
Labels:        app=my-app
Annotations:   <none>
Finalizers:    []
Capacity:      0
Access Modes:
Events:        <none>

PVC Describe:

Name:            pvc-b196868cd-bc75-12e8-ad32-075738325c
Labels:          <none>
Annotations:     <none>
StorageClass:    persistent
Status:          Available
Claim:           myapp/myapp-backup-pv-claim
Reclaim Policy:  Retain
Access Modes:    RWO
Capacity:        100Gi
Message:
Source:
    Type:        vSphereVolume (a Persistent Disk resource in vSphere)
    VolumePath:      StoragePolicyName:  %v

    FSType:                            [dsNTFTS19_0101] kubevols/kubernetes-dynamic-pvc-b196868cd-bc75-12e8-ad32-075738325c.vmdk
%!(EXTRA string=ext4, string=)Events:  <none>

Solution

  • The problem was not having annotations, since this is a VSphere storage the annotation volume.beta.kubernetes.io/storage-provisioner=kubernetes.io/vsphere-volume is a mandatory one.