HINT: PV volumes may be described like pvc-name-of-volume
which may be confusing!
- PV:
Persistent Volume
- PVC:
Persistent Volume Clame
- Pod -> PVC -> PV -> Host Machine
First find the pvs: kubectl get pv -n {namespace}
Then delete the pv in order set status to Terminating
kubectl delete pv {PV_NAME}
Then patch it to set the status of pvc to Lost
:
kubectl patch pv {PV_NAME} -p '{"metadata":{"finalizers":null}}'
Then get pvc volumes: kubectl get pvc -n storage
Then you can delete the pvc:
kubectl delete pvc {PVC_NAME} -n {namespace}
Theoretical example:
** Lets say we have kafka installed in storage namespace
$ kubectl get pv -n storage
$ kubectl delete pv pvc-ccdfe297-44c9-4ca7-b44c-415720f428d1
$ kubectl get pv -n storage
(hanging but turns pv status to terminating)
$ kubectl patch pv pvc-ccdfe297-44c9-4ca7-b44c-415720f428d1 -p '{"metadata":{"finalizers":null}}'
$ kubectl get pvc -n storage
kubectl delete pvc data-kafka-0 -n storage