Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PVC gets deleted even when persistence is enabled #24

Open
deshetti opened this issue Nov 13, 2020 · 22 comments
Open

PVC gets deleted even when persistence is enabled #24

deshetti opened this issue Nov 13, 2020 · 22 comments
Labels
bug Something isn't working needs investigation Needs to take time to understand the issue.

Comments

@deshetti
Copy link
Contributor

I installed the helm chart with persistence.enabled: true and when I uninstalled the helm chart I see that the PVC was deleted. I would assume that PVC would not be deleted when I uninstall the chart in persistence mode, it should be only be deleted manually.

@eskombro
Copy link
Member

eskombro commented Nov 17, 2020

Interesting, this deserves a little further investigation, as I see here developers having quite the opposite issue

When Helm installs a chart including a statefulset which uses volumeClaimTemplates to generate new PVCs for each replica created, Helm loses control on those PVCs.

Any insigths @renehernandez ? :)

@renehernandez
Copy link
Contributor

I think the issue lies that we are defining a PersistentVolumeClaim object at https://github.com/meilisearch/meilisearch-kubernetes/blob/master/charts/meilisearch/templates/pvc.yaml and mounting it in the StatefulSet definition; instead of relying on volumeClaimTemplates to automatically define the PVCs.

My suspiction is that since we are defining the PVC object and it is managed by Helm, then it gets deleted during the delete/uninstall operations, as oppose to declaring the PVC through the volumeClaimTemplates in the StatefulSet where Helm wouldn't keep track of the generated PVC as Helm resource and thus would follow the kubernetes behavior

@renehernandez
Copy link
Contributor

We could either moved the PVC to be declared as a volumeClaimTemplates section or add the helm.sh/resource-policy: keep annotation to the PVC template so it isn't deleted

@eskombro eskombro added this to Open issues in SDKs & Integrations via automation Dec 10, 2020
@veneliniliev
Copy link

I have the same problem.
after updating the cluster, the PVC is deleted and re-created

@alallema
Copy link
Contributor

Hi @veneliniliev,
Thanks for raising this issue. Indeed it seems that this issue hasn't been fixed. Can I ask how did you proceed to update your cluster did you uninstall and reinstall the helm chart?

@alallema
Copy link
Contributor

I close this issue due to inactivity, it does not seem to be still present. Feel free to reopen it if the problem is still there.

@brunoocasali brunoocasali added the stale Pull request or issue that has recieve no activity for a long time. label May 16, 2022
@veneliniliev
Copy link

I close this issue due to inactivity, it does not seem to be still present. Feel free to reopen it if the problem is still there.

I still have a problem.
I did a clean install of the latest version of the chart and after updating the cluster everything indexed disappeared

@alallema alallema reopened this May 18, 2022
@brunoocasali brunoocasali removed the stale Pull request or issue that has recieve no activity for a long time. label May 18, 2022
@alallema alallema added the needs investigation Needs to take time to understand the issue. label May 18, 2022
@NishaSharma14
Copy link

NishaSharma14 commented May 25, 2022

We are also facing the same issue. We have the persistence.enabled: true but with helm uninstall it's deleting the PVC.

@alallema alallema added the bug Something isn't working label May 31, 2022
@vincentri
Copy link

any update?

@deshetti
Copy link
Contributor Author

We had to create our own helm chart to support this and a few other features the current helm chart doesn't support like setting the master key from a secret: https://github.com/factly/helm-charts/tree/main/charts/meilisearch

The mount path on the helm chart is also wrong as of today.

Another major issue for which I am currently having to use this workaround: meilisearch/meilisearch#2503 (comment)

@alallema
Copy link
Contributor

Hi @deshetti,
Thank you very much for your feedback and for sharing your solution, I'm sorry I didn't take care of these issues, but I'm trying to address them as soon as possible, but it's not one of our priorities right now.

@veneliniliev
Copy link

veneliniliev commented Jun 30, 2022

Hi @deshetti, Thank you very much for your feedback and for sharing your solution, I'm sorry I didn't take care of these issues, but I'm trying to address them as soon as possible, but it's not one of our priorities right now.

@alallema
today I had this problem again.
For 5 hours, customers had problems with our application because of this.
it is unusable in the constant updates of GKE.
obviously, we will have to think of other search solutions for our application.

@alallema
Copy link
Contributor

Hi @veneliniliev,
I'm really sorry to hear that but unfortunately, we can't solve this problem at the moment, until we finish working on v0.28. And to be honest, I don't know why it's not fixed yet, but we are open source and we accept PR if someone finds the solution.
In the meantime, you can check this workaround

@miguelmoreba
Copy link

I had the same issue described here. This is how I avoided it:

I stopped using the helm chart and created a kustomization file, using the manifests provided in this repo and tweaking them to my needs. I think the issue has to do with the PVC becoming "orphan" whenever the helm chart is uninstalled.

  • Make sure to create a storageClass with reclaimPolicy set to Retain
  • When creating your PersistentVolumeClaim, set storageClass to the name of your newly created class

bors bot added a commit that referenced this issue Jul 4, 2022
123: Change the mount path with new meili_data path r=alallema a=alallema

# Pull Request

## What does this PR do?
Following this [issue](meilisearch/meilisearch#2503) and #24 the mount path should be update to allow persistence


Co-authored-by: alallema <amelie@meilisearch.com>
@NishaSharma14
Copy link

NishaSharma14 commented Jul 7, 2022

Hi @alallema ,
The workaround does not work me. I changed the mount path to /meili_data but the PVC still get deleted on helm uninstall
I am trying this on GKE.

@NishaSharma14
Copy link

We had to create our own helm chart to and apply changes to support the persistence. Thanks, @deshetti I took the reference from your repo.

@alallema
Copy link
Contributor

Hi @NishaSharma14,
I'm sorry to hear that and I understand your frustration. But like I said it's not one of our priorities right now. I will try to fix it as soon as possible.

@veneliniliev
Copy link

any update?

@churdstheword
Copy link

churdstheword commented Oct 21, 2022

@veneliniliev I am not here often and I am guessing that you've probably moved on from this, but I will tell you how we danced around this issue.

We used a feature of helm that prevents k8s resources from being deleted when uninstalling.
https://helm.sh/docs/howto/charts_tips_and_tricks/#tell-helm-not-to-uninstall-a-resource

(A snippet of our values file, showing how we passed in the annotation)
image

Since the helm chart attempts to create a pvc with the exact same name / configuration each time, adding the annotation will prevent it from being deleted when you uninstall, and when you reinstall, it will discover there is already a pvc with the name in the given namespace with the same configuration, and wont attempt to recreate it. (or at least that is my best understanding of how things were working here... 😅)

Hope this helps!

@alallema
Copy link
Contributor

Hi @churdstheword,
Thank you so much for this work around and for taking the time to share it here ❤️

@veneliniliev
Copy link

@veneliniliev I am not here often and I am guessing that you've probably moved on from this, but I will tell you how we danced around this issue.

We used a feature of helm that prevents k8s resources from being deleted when uninstalling. https://helm.sh/docs/howto/charts_tips_and_tricks/#tell-helm-not-to-uninstall-a-resource

(A snippet of our values file, showing how we passed in the annotation) image

Since the helm chart attempts to create a pvc with the exact same name / configuration each time, adding the annotation will prevent it from being deleted when you uninstall, and when you reinstall, it will discover there is already a pvc with the name in the given namespace with the same configuration, and wont attempt to recreate it. (or at least that is my best understanding of how things were working here... sweat_smile)

Hope this helps!

I have a problem when pod is moved from node to node or GKE is updated.
everything starts but the data is not restored :(

@jensschulze
Copy link

jensschulze commented May 26, 2023

If you do not want that Helm deletes your PVC, you must not let Helm mangage the PVC.

Just create a PVC by applying a Kubernetes resource and reference it in the persistence.existingClaim key in your values.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation Needs to take time to understand the issue.
Projects
No open projects
Development

No branches or pull requests