Kubernetes: Can't delete PersistentVolumeClaim (pvc)

后端 未结 9 1745
無奈伤痛
無奈伤痛 2020-12-13 02:08

I created the following persistent volume by calling

kubectl create -f nameOfTheFileContainingTheFollowingContent.yaml

apiVersion: v1
ki         


        
9条回答
  •  清歌不尽
    2020-12-13 02:23

    For me pv was in retain state, hence doing the above steps did not work.

    1st we need to change policy state as below :

    kubectl patch pv PV_NAME -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}'
    

    Then delete pvc as below.

    kubectl get pvc
    
    kubectl delete pvc PVC_NAME
    

    finally, delete pv with

    kubectl delete pv PV_NAME
    

提交回复
热议问题