Skip to main content
This guide walks you through fully removing a Midaz deployment from Kubernetes. helm uninstall removes the Helm-managed resources — and, importantly, it also deletes the MongoDB PersistentVolumeClaim along with them. Only the PostgreSQL volumes survive, because they are created from a StatefulSet volumeClaimTemplate. This page covers what goes with the release, what stays behind, and how to clean the rest up.
Uninstalling Midaz permanently deletes application data. helm uninstall alone is enough to destroy the MongoDB volume — back up before running it, not after. This operation is irreversible.

What uninstall deletes and what survives


No chart resource carries a helm.sh/resource-policy: keep annotation. Do not rely on Helm to protect any volume.

Prerequisites


Before uninstalling, back up your databases — helm uninstall destroys the MongoDB volume:
The PostgreSQL volumes survive helm uninstall, but the PVC cleanup below destroys them. Dump PostgreSQL too if you intend to run that step:
Then back up your current Helm values so you can reinstall with the same configuration if needed:
Also back up any plugin releases you run separately (plugins install into their own namespace, midaz-plugins):
CRM is part of the Midaz chart, not a separate release — there is no plugin-crm chart to back up or uninstall.
Verify all releases that will be affected:

Uninstalling the Helm release


Run the following command to uninstall the Midaz Helm release:
This removes all Kubernetes resources created by the Helm chart — Deployments, StatefulSets, Services, Ingresses, ConfigMaps, chart-managed Secrets, ServiceAccounts, RBAC resources, bootstrap Jobs, and the midaz-mongodb PVC. It does not remove the PostgreSQL StatefulSet PVCs, Secrets you created outside Helm, or the namespace. Verify that all Helm-managed pods have been removed:

Cleaning up persistent resources


PersistentVolumeClaims

After uninstall, the PostgreSQL claims are what remains. List them to confirm:
You should see data-midaz-postgresql-primary-0 and data-midaz-postgresql-replication-0. The midaz-mongodb claim is already gone — Helm deleted it with the release. Delete all remaining PVCs in the namespace (this destroys the PostgreSQL data):
Or delete specific PVCs by name:
Deleting these PVCs permanently destroys the PostgreSQL volume data — the ledger’s system of record. Make sure database backups are in place before running this command.

Secrets

Secrets created outside the Helm release lifecycle (e.g., kubectl create secret) are not removed by helm uninstall. List all secrets in the namespace and identify any that are no longer needed:
Delete individual orphaned secrets:
Or delete all secrets in the namespace:

ConfigMaps

ConfigMaps created manually or by bootstrap jobs may also remain. List them:
Delete orphaned ConfigMaps:

Namespace cleanup


Once all resources inside the namespace have been removed, delete the namespace itself:
Deleting the namespace will forcefully remove any remaining resources inside it. If a resource is stuck in Terminating state, you may need to remove its finalizers manually.
Verify the namespace is gone:

Complete cleanup


For staging, evaluation, or CI environments where a full teardown is safe, the following script automates the entire process:
Data loss is permanent. Run this only in environments where you have confirmed backups or where data loss is acceptable (staging, evaluation, CI). Do not run this in production without a full backup and team sign-off.
Save this as midaz-cleanup.sh, make it executable (chmod +x midaz-cleanup.sh), and run it with ./midaz-cleanup.sh.

Production considerations


In production, a full uninstall requires careful coordination. Follow these steps before running any cleanup commands:
  1. Back up all databases before helm uninstall. Export a full snapshot of PostgreSQL and MongoDB — the MongoDB volume is destroyed by the uninstall itself, not by the cleanup steps.
  2. Export critical data. If any data needs to be migrated or preserved, export it before uninstalling.
  3. Coordinate with your team. Notify all stakeholders of planned downtime and confirm the maintenance window.
  4. Uninstall plugins first. Remove plugin releases (Fees, Pix) before uninstalling the core Midaz release. CRM needs no separate uninstall — it ships inside the Midaz chart.
  5. Verify no traffic. Confirm that no active traffic is hitting the services before proceeding.
Uninstall plugins before the core release:
Then proceed with the persistent resource cleanup steps described above.