kubernetesvolumekubernetes-rook

Use ephemeral volumes in K8S cluster


I have a k8s cluster created using Kube-spray. The volume provisioning is supported using Rook. I was using persistent volumes till now.

The application is deployed using the helm chart. The helm release is upgraded multiple times for the test-purposes. I want the pods to use new volume each time I upgrade the chart. I don't want the pod to use the old data after helm upgrade.

How can I accomplish this? How to use ephemeral volumes?

Already tried removing the PVs before performing the helm upgrade.


Solution

  • One trick that we could try for temporary volume is:

    1. Install the chart with emptyDir volumes instead of pv or pvc.
    2. Run the tests with that deployments. That would make changes to volume contents.
    3. Delete the pods that use emptyDir volumes. This will also remove the current volume data. The pods will be recreated automatically.
    4. Do the helm upgrade.