When the reclaim policy is set to retain the volumes, they need to be removed separately by observing the following steps:
- Remember that deleting your workload will not remove the PVCs and PVs, unless a PVC manifest was included in the manifest:
$ kubectl delete -f redis-statefulset.yml
statefulset.apps "rd" deleted
service "redis" deleted
- List the remaining PVs:
$ kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-171fbee3-39bf-4450-961f-6c1417ff3897 1Gi RWO Retain Bound default/datadir-rd-1 aws-gp2 13m
pvc-8a538aa3-7382-4147-adde-1ea3dbaaafb4 1Gi RWO Retain Bound default/datadir-rd-0 aws-gp2 15m
pvc-b40df89b-5349-4f02-8510-917012579746 1Gi RWO Retain Bound default/datadir-rd-2 aws-gp2 12m
- Delete the PVCs. You can delete multiple PVCs at once by adding their names in a single command, similar to the following:
$ kubectl delete pvc datadir-rd-0 datadir-rd-1 datadir-rd-2
We have successfully removed all storage resources related to the application that was created as part of the Redis StatefulSet resource.