Skip to main content
This guide walks you through fully removing a Midaz deployment from Kubernetes. A standard helm uninstall removes the Helm-managed resources, but several persistent resources — PersistentVolumeClaims, Secrets, ConfigMaps, and the namespace itself — are intentionally left behind to prevent accidental data loss. This page covers how to clean them up completely when needed.
Uninstalling Midaz permanently deletes application data. Before proceeding, ensure you have backups of all databases and any data you need to retain. This operation is irreversible.

Prerequisites


Before uninstalling, back up your current Helm values so you can reinstall with the same configuration if needed:
helm get values midaz -n midaz > midaz-values-backup.yaml
Also back up any plugin releases:
helm get values plugin-crm -n midaz > plugin-crm-values-backup.yaml
helm get values plugin-fees -n midaz > plugin-fees-values-backup.yaml
Verify all releases that will be affected:
helm list -n midaz

Uninstalling the Helm release


Run the following command to uninstall the Midaz Helm release:
helm uninstall midaz -n midaz
This removes all Kubernetes resources created by the Helm chart — Deployments, Services, Ingresses, ConfigMaps managed by Helm, ServiceAccounts, and RBAC resources. It does not remove PersistentVolumeClaims, Secrets created outside Helm, or the namespace. Verify that all Helm-managed pods have been removed:
kubectl get pods -n midaz

Cleaning up persistent resources


PersistentVolumeClaims

PVCs hold your database volumes and are never removed by helm uninstall. List them first to confirm what exists:
kubectl get pvc -n midaz
Delete all PVCs in the namespace (this destroys all data stored in those volumes):
kubectl delete pvc --all -n midaz
Or delete specific PVCs by name:
kubectl delete pvc <pvc-name> -n midaz
Deleting PVCs permanently destroys the underlying volume data for PostgreSQL, MongoDB, and any other stateful dependency. 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:
kubectl get secrets -n midaz
Delete individual orphaned secrets:
kubectl delete secret <secret-name> -n midaz
Or delete all secrets in the namespace:
kubectl delete secrets --all -n midaz

ConfigMaps

ConfigMaps created manually or by bootstrap jobs may also remain. List them:
kubectl get configmaps -n midaz
Delete orphaned ConfigMaps:
kubectl delete configmap <configmap-name> -n midaz

Namespace cleanup


Once all resources inside the namespace have been removed, delete the namespace itself:
kubectl delete namespace midaz
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:
kubectl get namespace midaz

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.
#!/bin/bash
set -e

NAMESPACE=midaz
RELEASE=midaz

echo "==> Uninstalling Helm release: $RELEASE"
helm uninstall "$RELEASE" -n "$NAMESPACE" || true

echo "==> Deleting all PersistentVolumeClaims"
kubectl delete pvc --all -n "$NAMESPACE" || true

echo "==> Deleting all Secrets"
kubectl delete secrets --all -n "$NAMESPACE" || true

echo "==> Deleting all ConfigMaps"
kubectl delete configmaps --all -n "$NAMESPACE" || true

echo "==> Deleting namespace: $NAMESPACE"
kubectl delete namespace "$NAMESPACE" || true

echo "==> Done. Midaz has been fully removed."
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. Export a full snapshot of PostgreSQL and MongoDB before touching any resources.
  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 (CRM, Fees, Pix) before uninstalling the core Midaz release.
  5. Verify no traffic. Confirm that no active traffic is hitting the services before proceeding.
Uninstall plugins before the core release:
helm uninstall plugin-crm -n midaz || true
helm uninstall plugin-fees -n midaz || true
helm uninstall midaz -n midaz
Then proceed with the persistent resource cleanup steps described above.