Deleting EBS persistent volumes

When the reclaim policy is set to retain the volumes, they need to be removed separately by observing the following steps:

  1. 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
  1. 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
  1. 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
  1. 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:

  1. Open your AWS Management Console and click on EC2 under the Compute options:

  1. Under the Resources section, click on Volumes:

  1. Select the available and unused volumes. From the Using EBS storage classes to create dynamic persistent volumes recipe, we have three unused volumes:

  1. 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.131.10