<p>I've searched (perhaps poorly?) but haven't found anything on this topic.</p>
<p>We strive to go for a complete Gitops approach for our application, which means we're using Git to store our application configuration and are introducing Argo CD (with bases/overlays and kustomize) to keep the desired state of the application in sync with the current, actual state.</p>
<p>As the team providing us with the application is still transitioning to Kubernetes, we have some use cases where we need to completely stop the application (including any PVCs used by it). For those use cases, we basically kill everything associated with the namespace, do whatever needs doing and then start everything up again.</p>
<p>For Deployments, I created a stopApp.yaml file that sets the spec.replicas field to 0 for all Deployments and I reference this stopApp.yaml in the patchesStrategicMerge: field in the kustomization.yaml of the development overlay. This is tested and works as desired.</p>
<p>To start everything up again, all I have to do is comment out the line referencing that stopApp.yaml in the kustomization.yaml file.</p>
<p>But how do I achieve this for PVCs?</p>
<p>We create PVCs like this, as an example:</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: dummy-data
  labels:
    component: dummy
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
</code></pre>
<p>In my searching I've found a bunch of discussions on PVs and PVCs and lots of ways of deleting them with kubectl or via bash but haven't come across any discussions on how to kill PVCs via Git + kustomize + Argo CD and &quot;the Gitops&quot; approach in general.</p>
<p>Thanks for reading all the way to here! Thanks in advance for any pointers on this.</p>

ismi
<p>This is a limitation by kustomize, not the gitops approach. Helm provides lifecycle hooks which you could use to solve your case.</p>
<p>Another option is to design your application in a more suitable fashion to run on kubernetes without the need to delete everything and restart.</p>
