79612845

Date: 2025-05-08 16:59:06
Score: 0.5
Natty:
Report link

You cannot directly edit the reclaim policy since changing the StorageClass's reclaimPolicy will only affect newly created PVs. It will not change the persistentVolumeReclaimPolicy of your existing PVs.

The recommended approach is to create a new StorageClass with the "Retain" policy then migrate your existing PVCs using this command:

  1. List the PersistentVolumes in your cluster:

    kubectl get pv 
    
  2. Choose one of your PersistentVolumes and change its reclaim policy:

     kubectl patch pv <your-pv-name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' 
    
  3. Verify that your chosen PersistentVolume has the right policy:

    kubectl get pv
    

For further reference you can refer to this documentation.

Reasons:
  • Blacklisted phrase (1): this document
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: p_lycs