# Pvc s should not deleted while deleting a cluster

**URL:** <https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [November 10, 2020, 4:34am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846 "2020-11-10T04:34:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![knagasri](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@knagasri](https://discuss.elastic.co/u/knagasri)\
**Post date:** [November 10, 2020, 4:34am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846/1 "2020-11-10T04:34:51Z")

</div>

While deleting a elasticsearch cluster, pvcs are also getting deleted. Is there any annotation that would remain pvc after deleting cluster?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 10, 2020, 4:50am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846/2 "2020-11-10T04:50:07Z")

</div>

What do you mean by PVC?

---

<div class="post-metadata">

**Author:** ![knagasri](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@knagasri](https://discuss.elastic.co/u/knagasri)\
**Post date:** [November 10, 2020, 5:07am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846/3 "2020-11-10T05:07:58Z")

</div>

By default, operator creates persistent volume claims with a capacity of 1 Gi in each pod in an elasticsearch cluster to prevent data loss in case of accidental pod deletion. Persistent volume claim resources are getting deleted when deleting an elasticsearch cluster. Is there any option to preserve PVCs after deleting the cluster.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 10, 2020, 5:08am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846/4 "2020-11-10T05:08:54Z")

</div>

Is this using ECK?

---

<div class="post-metadata">

**Author:** ![knagasri](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@knagasri](https://discuss.elastic.co/u/knagasri)\
**Post date:** [November 10, 2020, 5:12am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846/5 "2020-11-10T05:12:27Z")

</div>

I refer the following document

> <https://github.com/elastic/cloud-on-k8s/issues/2328>
>
> Relates to #1288. When removing Elasticsearch I don't necessary want to remove PVC, because it will lead to a data loss.
> Expected...

  
and tried with following command. But, still getting deleted

```auto
preservePvcOnDeletion: true

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 10, 2020, 5:13am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846/6 "2020-11-10T05:13:07Z")

</div>

Ok, let me move this to the ECK category.

---

<div class="post-metadata">

**Author:** ![dkow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dkow/32/47340_2.png) [@dkow](https://discuss.elastic.co/u/dkow)\
**Post date:** [November 10, 2020, 7:01am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846/7 "2020-11-10T07:01:41Z")

</div>

Hey @knagasri, thanks for your question. And thanks @warkolm for moving this to ECK.

The `preservePvcOnDeletion: true` that was mention in the issue was just discussed as an option, it's not something that's currently implemented.

While you can't preserve PVCs today, you can preserve PVs if the storage class being used has `reclaimPolicy: Retain`. I'm not sure if this is something you are looking for, but you can check [a tool](https://github.com/elastic/cloud-on-k8s/tree/master/hack/reattach-pv) that we've created that allows to recreate a cluster based on already existing PVs.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 8, 2020, 7:01am UTC](https://discuss.elastic.co/t/pvc-s-should-not-deleted-while-deleting-a-cluster/254846/8 "2020-12-08T07:01:43Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
