<p>I have a workflow where a persistent volume is created however, the volume is not removed after the job has finished successfully.</p>
<pre><code>  volumeClaimTemplates:
    - metadata:
        name: some_volume
      spec:
        accessModes: ['ReadWriteMany']
        resources:
          requests:
            storage: 2Gi
</code></pre>
<p>I have been looking for some policy that can be set to remove the volume after the workflow has finished successfully however, I could not find anything.
Someone suggested creating a cronjob to remove the volume. But is there an easier way to define some policies to remove a persistent volume claim after the workflow has finished successfully?</p>

Marc
<p>The persistent volume will be deleted by setting podGC and volumeClaimGC:</p>
<pre><code>spec:
  entrypoint: main
  volumeClaimGC:
    strategy: OnWorkflowCompletion
  podGC:
    strategy: OnPodSuccess
  volumeClaimTemplates:
  - metadata:
      name: test-volume
    spec:
      accessModes: ['ReadWriteMany']
      resources:
        requests:
          storage: 1Gi
</code></pre>
