==============================
Uninstalling Workbench and K3s
==============================

This page provides step-by-step instructions for removing Workbench along with K3s from your cluster cleanly and safely. 

.. _pre_install_cleanup:

Cleaning up after pre-installation
==================================

If Workbench is not installed, but you have run ``./k3s_preinstall.sh``, the only changes that have been made to your system are the staging of installation asset files, which consume a small amount of space. If you want to remove those files, run the following commands:

.. code-block:: none

    sudo rm -rf /etc/rancher/k3s /var/lib/rancher/k3s /usr/local/bin/k3s
    sudo mv /etc/environment.k3s-orig /etc/environment

Uninstalling
============

To uninstall Workbench and K3s from your cluster:

#. If Workbench is running, you'll need to perform a backup before proceeding. This ensures that no data corruption occurs during the K3s shutdown process. Perform a backup by running the following command: 

    .. code-block:: none

        ae_backup.sh

#. Pause the application by running the following command: 

    .. code-block:: none

        ae_pause.sh

#. If your cluster has worker nodes, uninstall them by running the following command on each node: 

    .. code-block:: none

        /usr/local/bin/k3s-agent-uninstall.sh

#. Uninstall K3s by running the following commands on the server:

    .. code-block:: none

        /usr/local/bin/k3s-uninstall.sh
        sudo mv /etc/environment.k3s-orig /etc/environment

    This does not remove existing Workbench data (data stored in ``/opt/anaconda/storage``). If you would like to remove this data, perform the :ref:`pre-installation cleanup commands <pre_install_cleanup>`. 

