How to clean up PVCs.

I noticed that simply deleting the cr.yaml, which deletes the statefulset pods is not enough to delete the PVCs associated with it. Doing a manual kubectl delete pvc command is tedius.

I did a describe pvc command with the output:

Name: mongod-data-mongodb-trial-cluster-rs-0

Namespace: psmdb

StorageClass: standard

Status: Bound

Volume: pvc-593638eb-53c2-48db-a18d-2518ef977e76

Finalizers: [kubernetes.io/pvc-protection]

Notice that this finalizer for pvc-protection is enabled which I assume is the reason why it doesn’t get automatically deleted. How can we disable this so that pvc gets deleted along with the pods?

1 Like

Hello
PSMDB operator does not have the ability for post-removal actions.
Could you please create a ticker on https://jira.percona.com for this?

1 Like

Hi Ivan, 
Will do so then. Thanks for the reply. 

1 Like

This feature will be shipped in the next release (March 2021). It is tracked here: [K8SPSMDB-260] Automatic deletion of PVCs when destroying the cluster - Percona JIRA

1 Like