0

I've searched (perhaps poorly?) but haven't found anything on this topic.

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.

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.

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.

To start everything up again, all I have to do is comment out the line referencing that stopApp.yaml in the kustomization.yaml file.

But how do I achieve this for PVCs?

We create PVCs like this, as an example:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: dummy-data
  labels:
    component: dummy
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi

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 "the Gitops" approach in general.

Thanks for reading all the way to here! Thanks in advance for any pointers on this.

ismi
  • 1
  • 2

1 Answers1

1

This is a limitation by kustomize, not the gitops approach. Helm provides lifecycle hooks which you could use to solve your case.

Another option is to design your application in a more suitable fashion to run on kubernetes without the need to delete everything and restart.

Thomas
  • 11,272
  • 2
  • 24
  • 40