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 the PVC manifest was included in the manifest:
$ kubectl delete -f redis-statefulset.yml
- 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
- Delete the PVs. You can delete multiple PVs at once by adding their names in a single command, similar to the following:
$ kubectl delete pv <pv-name-1> <pv-name-2> <pv-name-3>
Although we removed PVCs and PVs, our EBS volumes are still retained. Let's now remove these as well:
- Open your AWS Management Console and click on EC2 under the Compute options:
- Under the Resources section, click on Volumes:
- Select the available and unused volumes. From the Using EBS storage classes to create dynamic persistent volumes recipe, we have three unused volumes:
- From the Actions drop-down menu, select Delete Volumes:
We have successfully removed all storage resources related to the application that was created as part of the Redis StatefulSet resource.