Helm install re-use PVC

7,260 views
Skip to first unread message

wer...@beroux.com

unread,
Jan 26, 2018, 8:17:25 AM1/26/18
to kubernetes-sig-apps
Goals:
  • I wanted to delete old versions of a chart (because my packet size got too big), so I only found one way: helm delete --purge.
  • I want to delete and later deploy a chart, but keep the PersistentVolumeClaim.

What's the issue:
  • helm install or helm update --install do not let you re-use an existing PVC (even if that resource was marked with helm.sh/resource-policy: keep).

Example of bugs regarding this:

Is there any known hack/way to bypass this? The only "workaround" I know is horrible:
  1. Create a new clone from current PVC (or repeat steps similar below to do that).
  2. Delete the PVC.
  3. Change deployment Yaml to deploy instead image alpine and add additional mount the copy of the original image (without including its PVC inside templates/)
  4. kubectl exec -it ...
    1. apk add --no-cache rsync && rsync -va --delete FROM/ TO
  5. Delete the cloned PVC/disk. and undo all local Yaml changes.
  6. Deploy normal image and normal mounted volumes.

hasan....@sap.com

unread,
Jul 17, 2018, 8:45:10 AM7/17/18
to kubernetes-sig-apps
Statefulset + VolumeClaimTemplates should work out of the box.

Werner Beroux

unread,
Aug 7, 2018, 4:32:48 AM8/7/18
to hasan....@sap.com, kubernetes-sig-apps
Thanks, I'll try to find and test that.

--
You received this message because you are subscribed to a topic in the Google Groups "kubernetes-sig-apps" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubernetes-sig-apps/sLL2pCJ5Ab8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubernetes-sig-...@googlegroups.com.
To post to this group, send email to kubernete...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-apps/5fbba882-eaa2-4f51-a7fe-c0ca188ce031%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

wer...@beroux.com

unread,
Aug 7, 2018, 4:57:42 AM8/7/18
to kubernetes-sig-apps
Did you mean using rdb / Ceph? Because I'm using standard Google Cloud disks volumes ReadWriteOnce.


On Tuesday, 7 August 2018 10:32:48 UTC+2, Werner Beroux wrote:
Thanks, I'll try to find and test that.

On Tue, 17 Jul 2018 at 14:45 <hasan....@sap.com> wrote:
Statefulset + VolumeClaimTemplates should work out of the box.


On Friday, January 26, 2018 at 4:17:25 PM UTC+3, wer...@beroux.com wrote:
Goals:
  • I wanted to delete old versions of a chart (because my packet size got too big), so I only found one way: helm delete --purge.
  • I want to delete and later deploy a chart, but keep the PersistentVolumeClaim.

What's the issue:
  • helm install or helm update --install do not let you re-use an existing PVC (even if that resource was marked with helm.sh/resource-policy: keep).

Example of bugs regarding this:

Is there any known hack/way to bypass this? The only "workaround" I know is horrible:
  1. Create a new clone from current PVC (or repeat steps similar below to do that).
  2. Delete the PVC.
  3. Change deployment Yaml to deploy instead image alpine and add additional mount the copy of the original image (without including its PVC inside templates/)
  4. kubectl exec -it ...
    1. apk add --no-cache rsync && rsync -va --delete FROM/ TO
  5. Delete the cloned PVC/disk. and undo all local Yaml changes.
  6. Deploy normal image and normal mounted volumes.

--
You received this message because you are subscribed to a topic in the Google Groups "kubernetes-sig-apps" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubernetes-sig-apps/sLL2pCJ5Ab8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubernetes-sig-apps+unsub...@googlegroups.com.
To post to this group, send email to kubernetes-sig-apps@googlegroups.com.

wer...@beroux.com

unread,
Aug 7, 2018, 6:33:31 PM8/7/18
to kubernetes-sig-apps
So I played a bit around and saw it creates a PVC with just another random name but behaves a bit differently.

  1. Deleting the StatefulSet (kubectl delete statefulset --all) and re-deploying it using Helm, does seem to keep the PVC. --> Good
  2. Doing a "helm delete --purge my-release", noticing the PVC remains, then re-creating a release of the same name also reuses that PVC (with a random name in GCP) --> Awesome!
So yes, it looks like using StatefulSet with persistentVolumeTemplate will reuse the PVC. I guess the only constraint is that the template name in k8s remains the same.

Thanks !
Reply all
Reply to author
Forward
0 new messages