简体   繁体   中英

What happens if I delete a PVC that it's volume is bound to a PV?

The problem is that I need to modify the StorageClassName but it's not possible because there was a blank StorageClassName assigned.

This PVC is bound to a PV, so, if I delete the PVC to create a new one with the StorageClassName, the data that is in my AWS will be deleted?

You can recreate an existing PVC reusing the same PV with no data losses by using reclaim policy .

In case of Delete, the PV is deleted automatically when the PVC is removed, and the data on the PVC will also be lost. In that case, it is more appropriate to use the “Retain” policy. With the “Retain” policy, if a user deletes a PersistentVolumeClaim, the corresponding PersistentVolume is not deleted. Instead, it is moved to the Released phase, where all of its data can be manually recovered.

Reclaim Policy: Used to tell the cluster what to do with the volume after releasing its claim. Current reclaim policies are:

  • Retain — manual reclamation
  • Recycle — basic scrub (rm -rf/thevolume/*)
  • Delete — associated storage assets such as AWS EBS, GCE PD, Azure Disk, or OpenStack Cinder volume is deleted

NOTE: Extremely recommended to use Retain policy for PVCs that store critical data.

Here in this blog you have detailed steps to recreate a PVC in another name space similarly you can change the storage class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM