Reinstalling KOTS While Preserving Your Application

This guide provides steps to reinstall KOTS while keeping your application running.

Overview

This procedure:

  1. Exports your app configuration
  2. Deletes the rqlite database
  3. Reinstalls your app with the saved configuration

Important: Your running application will not be impacted as long as you reinstall the same KOTS version that is currently deployed.

Prerequisites

  • kubectl access to the KOTS namespace
  • Application license file
  • Admin Console password

Procedure

1. Export Configuration Values

NAMESPACE="<your-namespace>"

# Export decrypted config to a file
kubectl kots get config --namespace $NAMESPACE --decrypt > config-backup.yaml

:warning: If kotsadm is not running and you cannot export config values, use the config decryption tool to extract them directly from rqlite before proceeding. Without a config backup, you will lose all application configuration values including passwords.

2. Clear Object Storage

# If using embedded MinIO
kubectl exec -it deployment/kotsadm -n $NAMESPACE -- sh -c '
  s3cmd --access_key=$S3_ACCESS_KEY_ID \
        --secret_key=$S3_SECRET_ACCESS_KEY \
        --host=$(echo $S3_ENDPOINT | awk -F/ "{print \$3}") \
        --no-ssl \
        del s3://$S3_BUCKET_NAME --recursive --force
'

3. Scale Down KOTS

kubectl scale deployment kotsadm -n $NAMESPACE --replicas=0
kubectl scale sts kotsadm-rqlite -n $NAMESPACE --replicas=0

# Wait for pods to terminate

4. Delete the Database PVC(s)

# For single-node rqlite
kubectl delete pvc kotsadm-rqlite-kotsadm-rqlite-0 -n $NAMESPACE

# For HA rqlite (3 nodes), delete all PVCs
kubectl delete pvc kotsadm-rqlite-kotsadm-rqlite-0 -n $NAMESPACE
kubectl delete pvc kotsadm-rqlite-kotsadm-rqlite-1 -n $NAMESPACE
kubectl delete pvc kotsadm-rqlite-kotsadm-rqlite-2 -n $NAMESPACE

# Or delete all rqlite PVCs at once
kubectl delete pvc -l app=kotsadm-rqlite -n $NAMESPACE

5. Scale KOTS Back Up

# Start rqlite with fresh database
# For single-node rqlite
kubectl scale sts kotsadm-rqlite -n $NAMESPACE --replicas=1

# For HA rqlite (3 nodes)
kubectl scale sts kotsadm-rqlite -n $NAMESPACE --replicas=3

# Wait for rqlite to be ready
kubectl wait --for=condition=ready pod -l app=kotsadm-rqlite -n $NAMESPACE --timeout=180s

# Start kotsadm
kubectl scale deployment kotsadm -n $NAMESPACE --replicas=1

# Wait for kotsadm to be ready
kubectl wait --for=condition=ready pod -l app=kotsadm -n $NAMESPACE --timeout=180s

6. Reinstall Your Application

kubectl kots install <app-name> \
  --namespace $NAMESPACE \
  --shared-password <admin-console-password> \
  --license-file license.yaml \
  --config-values config-backup.yaml
1 Like