Delete old application archives

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) events or disk space shortages.

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