Clean up and delete Astronomer Software Deployments
This document explains how to manage the deletion and cleanup of Deployments on your Astronomer Software cluster.
Delete a Deployment
You can delete an Airflow Deployment using the Delete Deployment button at the bottom of the Deployment’s Settings tab.
When you delete a Deployment, you delete your Airflow webserver, scheduler, metadata database, and deploy history, and you lose any configurations set in the Airflow UI.
By default, Astro performs a soft delete when you delete a Deployment. After you delete a Deployment, your Astronomer database, the corresponding Deployment record receives a deletedAt value and continues to persist until permanently deleted through a hard delete. A hard delete includes both the Deployment’s metadata database and the Deployment entry in your Astronomer database. 14 days after your Deployment’s soft delete, Astronomer automatically runs a hard delete cronjob that deletes any values that remained after your soft delete.
Configure Deployment hard delete jobs
Astronomer runs a cronjob to hard delete the deleted Deployment’s metadata database and Deployment entry in your Astronomer database at midnight on a specified day. You can enable whether this cronjob runs or not, how many days after your soft delete to run the cronjob, and what time of day to run the cronjob by editing astronomer.houston.cleanupDeployments in your Astronomer Helm chart.
The following is an example of how you might configure the cronjob in your Helm chart:
Manually hard delete a Deployment
To reuse a custom release name given to an existing Deployment after a soft delete, but before Astronomer automatically cleans up any persisting Deployment records, you need to hard delete both the Deployment’s metadata database and the Deployment’s entry in your Astronomer database.
-
Enable hard delete as an option at the platform level. To enable this feature, set
astronomer.houston.config.deployments.hardDeleteDeployment: truein yourconfig.yamlfile and push the changes to your platform as described in Apply a config change. -
Hard delete a Deployment with the Software UI or Astro CLI.
-
Software UI: Go to the Deployment’s Settings tab and select Delete Deployment. Then, select the Hard Delete? checkbox before confirming Delete Deployment.

-
Astro CLI: Run
astro deployment delete --hard.
This action permanently deletes all data associated with a Deployment, including the database and underlying Kubernetes resources.
Clean Deployment task metadata
You can run a cronjob to automatically archive task and DAG metadata from your Deployment. This job runs airflow db clean for all of your Deployments and exports the results for each Deployment as a file to your external storage service. To run this job for a Deployment, you must install the Astronomer-maintained airflow-dbcleanup-plugin on the Deployment.
-
For each of your Deployments, add the following line to the
requirements.txtfile of your Deployment’s Astro project. Replace<latest-version>with the latest available version in theairflow-dbcleanup-pluginGitHub repository. -
Configure an Airflow connection to your external storage service in JSON or URI format so that it can be stored as an environment variable. You must use a service account to authenticate to your service. See Airflow documentation to learn how to configure your connection.
-
Store the connection environment variable as a Kubernetes Secret on your Astronomer cluster. See Kubernetes documentation.
-
Add the following configuration to your
values.yamlfile and change the default values as needed. -
Push the configuration change. See Apply a config change.