Saturday, 23 April 2022

Deleting PV and PVC in Kubernetes

 

HINT: PV volumes may be described like pvc-name-of-volume which may be confusing!

  • PV: Persistence Volume
  • PVC: Persistence Volume Clame
  • Pod -> PVC -> PV -> Host Machine

  1. First find the pvs: kubectl get pv -n {namespace}

  2. Then delete the pv in order set status to Terminating

kubectl delete pv {PV_NAME}

  1. Then patch it to set the status of pvc to Lost: kubectl patch pv {PV_NAME} -p '{"metadata":{"finalizers":null}}'

  2. Then get pvc volumes: kubectl get pvc -n storage

  3. Then you can delete the pvc: kubectl delete pvc {PVC_NAME} -n {namespace}

No comments:

Post a Comment