Delete old application releases

KOTS Admin Console does not natively provide a way to delete application releases. This can cause performance issues as the number of application archives grows, potentially leading to out-of-memory (OOM) event, disk space shortages or high CPU utilisation.

This guide provides instructions for safely removing older releases by directly managing the KOTS database and object storage.

:warning: Warning: These operations manipulate internal KOTS data structures. These procedures may change without notice in future KOTS releases. Use with caution and always back up your data before proceeding.

Prerequisites

  • kubectl access to your Kubernetes cluster
  • Proper permissions to execute commands in the KOTS namespace
  • Understanding of your application’s release sequence numbers

Step 1 : Delete application archive metadata from KOTS database

# exec into KOTS rqlite
export NAMESPACE=<namespace>
kubectl exec -it sts/kotsadm-rqlite -n $NAMESPACE -- rqlite -u kotsadm:$(kubectl get secret kotsadm-rqlite -n $NAMESPACE -o jsonpath='{.data.password}' | base64 -d)

# delete versions less than desired sequence
delete from app_version where sequence < <desired-sequence>;
delete from app_downstream_version where sequence < <desired-sequence>;
delete from app_downstream_output where downstream_sequence < <desired-sequence>;

# Exit rqlite
.exit

Step 2: Delete application archives from KOTS object storage (when Minio is used)

# exec into minio pod
kubectl exec -it sts/kotsadm-minio -n <namespace> -- sh
mc alias set myminio http://localhost:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY

# list all sequences
mc ls --summarize --recursive myminio/kotsadm/

# delete specific sequence
mc rm myminio/kotsadm/<app-id>/<sequence-number>.tar.gz

# Or delete multiple archives at once (example: sequences 1-10)
for i in {1..10}; do mc rm myminio/kotsadm/<app-id>/$i.tar.gz; done

# Verify deletion
mc ls --summarize myminio/kotsadm/<app-id>/

Verifying Changes

After completing these steps, verify that:

  1. The KOTS Admin Console still functions properly
  2. Your application can still be managed normally
  3. Disk space has been reclaimed
1 Like

Hi,

I appreciate the housekeeping steps provided here. But seeing as this is a manual workaround, are there any plans for Replicated to introduce housekeeping within KOTS (either as a command in the CLI or admin console)? Perhaps something similar to the support bundles page in the admin console can be done, where it lists application packages that have been downloaded and we can select which ones to delete.

Thanks,
Migs

we are currently working on an overhaul to our installer that will completely change how release information is stored. ultimately our goal is to remove the rqlite and MinIO dependencies so that we do not store information there anymore but store info in Kubernetes instead. because of that, it’s not likely that we would provide a new cleanup command or anything like that.

this is ongoing and likely won’t be available for a few months, but we have talked to Steve and Guillaume at ITRS about this and they’re familiar with what we’re working on.

1 Like