Uninstall StorageOS

Procedure to remove a StorageOS cluster permanently

This document details a step-by-step procedure to remove StorageOS from a Kubernetes cluster.

Remember that StorageOS enables the stateful applications within your cluster. It is very important to remove any applications that rely on StorageOS before you remove StorageOS itself, or those applications will suffer unrecoverable errors.

Remove Stateful Workloads and Data

  1. Delete any resources using StorageOS volumes

    Delete any statefulsets, deployments or pods that are using StorageOS Volumes.

  2. Delete PVCs using StorageOS

    Delete any Persistent Volume Claims that are using StorageOS.

    $ kubectl -n $NS delete pvc $PVC
    

    This will delete data held by StorageOS and won’t be recoverable.

Remove StorageOS Cluster

  1. Delete StorageOS Cluster

    $ kubectl get storageoscluster --all-namespaces # Find the namespace where the Custom Resource runs
    $ kubectl -n $NS delete storageoscluster --all  # Usually to be found in storageos-operator
    
  2. Wait until the StorageOS resources are gone

    $ kubectl -n kube-system get pod # NS: Namespace where StorageOS Daemonset is running, usually 'kube-system'
    

Uninstall the StorageOS Operator

Delete the Cluster Operator once the StorageOS Pods are terminated

  1. Delete the StorageOS Operator deployment

    $ kubectl delete -f https://github.com/storageos/cluster-operator/releases/download/v2.2.0/storageos-operator.yaml
    

Procedure is finished. StorageOS is now uninstalled.

Remove StorageOS contents and metadata (unrecoverable)

The steps up until now have been recoverable - as long as the etcd backing StorageOS and the contents of /var/lib/storageos on your nodes are safe then StorageOS can be reinstalled. For complete removal and recovery of disk space, you can use the following procedure.

The following steps will delete all data held by StorageOS and won’t be recoverable.

  1. Remove the StorageOS data directory

    There are two ways to remove the StorageOS data directory:

    1. (Option 1) Login in to the hosts and execute the following commands

      $ sudo rm -rf /var/lib/storageos
      $ sudo umount /var/lib/kubelet/plugins_registry/storageos
      
    2. (Option 2) Execute the following command to deploy a DaemonSet that removes the StorageOS data directory.

      N.B This step is irreversible and once the data is removed it cannot be recovered.

      Run the following command where kubectl is installed and with the context set for your Kubernetes cluster.

      $ curl -s https://docs.storageos.com/v2.2/sh/permanently-delete-storageos-data.sh | bash
      
  2. Flush Etcd Data

    This will remove any keys written by StorageOS.

    $ export ETCDCTL_API=3
    $ etcdctl --endpoints=http://$ETCD_IP:2379 del --prefix "storageos"
    

    If running Etcd with mTLS, you can set the certificates location with the following command.

    $ export ETCDCTL_API=3
    $ etcdctl --endpoints=https://$ETCD_IP:2379 \
            --cacert=/path/to/ca.pem          \
            --cert=/path/to/client-cert.pem   \
            --key=/path/to/client-key.pem     \
            del --prefix "storageos"