In my Mongo Helm Chart, I am using PVC for Persistence volume. I am using the chart to install Mongo. When I delete the chart my PV gets deleted. So, I found something to patch it in.
kubectl patch pv <your-pv-name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
After this my PV is not getting deleted just the status in Released
pvc-fc29a491-499a-11e9-a426-42010a800ff9 8Gi RWO Retain Released default/myapp-mongodb standard 3d
How can I bound this PV to my new helm chart installation so that my data should remain persistent even after deleting my Helm Chart?
I found one work around.I have created a PVC independent of helm chart and just using it in my deployment.yaml file.
If there is existing claim just use the existing one otherwise create a new Claim.
{{- if .Values.persistence.enabled }}
{{- if .Values.persistence.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}
{{- else}}
persistentVolumeClaim:
claimName: {{ (include "mongodb.fullname" .) }}
{{- end}}
It's still not resolved issue by Helm.
The 'hack' to deal with it, you can find here:
https://groups.google.com/forum/#!topic/kubernetes-sig-apps/sLL2pCJ5Ab8