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
Delete any resources using StorageOS volumes
Delete any statefulsets, deployments or pods that are using StorageOS Volumes.
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
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
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
Delete the StorageOS Operator deployment
$ kubectl delete -f https://github.com/storageos/cluster-operator/releases/download/v2.3.1/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.
Remove the StorageOS data directory
There are two ways to remove the StorageOS data directory:
(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
(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
kubectlis installed and with the context set for your Kubernetes cluster.
$ curl -s https://docs.storageos.com/sh/permanently-delete-storageos-data.sh | bash
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"