Removing Portworx
Remove a Portworx volume, a storage node, or the entire Portworx cluster if you don't need it anymore.
Removing Portworx volumes from apps
When you added storage from your Portworx cluster to your app, you have three main components: the Kubernetes persistent volume claim (PVC) that requested the storage, the Kubernetes persistent volume (PV) that is mounted to your pod and described in the PVC, and the Portworx volume that blocks space on the physical disks of your Portworx cluster. To remove storage from your app, you must remove all components.
-
List the PVCs in your cluster and note the NAME of the PVC, and the name of the PV that is bound to the PVC and shown as VOLUME.
oc get pvc
Example output
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE px-pvc Bound pvc-06886b77-102b-11e8-968a-f6612bb731fb 20Gi RWO px-high 78d
-
Review the
ReclaimPolicy
for the storage class.oc describe storageclass <storageclass_name>
If the reclaim policy says
Delete
, your PV and the data on your physical storage in your Portworx cluster are removed when you remove the PVC. If the reclaim policy saysRetain
, or if you provisioned your storage without a storage class, then your PV and your data are not removed when you remove the PVC. You must remove the PVC, PV, and the data separately. -
Remove any pods that mount the PVC.
-
List the pods that mount the PVC.
oc get pods --all-namespaces -o=jsonpath='{range .items[*]}{"\n"}{.metadata.name}{":\t"}{range .spec.volumes[*]}{.persistentVolumeClaim.claimName}{" "}{end}{end}' | grep "<pvc_name>"
Example output
blockdepl-12345-prz7b: claim1-block-bronze
If no pod is returned in your CLI output, you don't have a pod that uses the PVC.
-
Remove the pod that uses the PVC.
If the pod is part of a deployment, remove the deployment.
oc delete pod <pod_name>
-
Verify that the pod is removed.
oc get pods
-
-
Remove the PVC.
oc delete pvc <pvc_name>
-
Review the status of your PV. Use the name of the PV that you retrieved earlier as VOLUME.
oc get pv <pv_name>
When you remove the PVC, the PV that is bound to the PVC is released. Depending on how you provisioned your storage, your PV goes into a
Deleting
state if the PV is deleted automatically, or into aReleased
state, if you must manually delete the PV. Note: For PVs that are automatically deleted, the status might briefly sayReleased
before it is deleted. Rerun the command after a few minutes to see whether the PV is removed. -
If your PV is not deleted, manually remove the PV.
oc delete pv <pv_name>
-
Verify that the PV is removed.
oc get pv
-
Verify that your Portworx volume is removed. Log in to one of your Portworx pods in your cluster to list your volumes. To find available Portworx pods, run
oc get pods -n kube-system | grep portworx
.oc exec <portworx-pod> -it -n kube-system -- /opt/pwx/bin/pxctl volume list
-
If your Portworx volume is not removed, manually remove the volume.
oc exec <portworx-pod> -it -n kube-system -- /opt/pwx/bin/pxctl volume delete <volume_ID>
Removing a worker node from your Portworx cluster or the entire Portworx cluster
You can exclude worker nodes from your Portworx cluster or remove the entire Portworx cluster if you don't want to use Portworx anymore.
Removing your Portworx cluster removes all the data from your Portworx cluster. Make sure to create a snapshot for your data and save this snapshot to the cloud.
- Remove a worker node from the Portworx cluster: If you want to remove a worker node that runs Portworx and stores data in your Portworx cluster, you must migrate existing pods to remaining worker nodes and then uninstall Portworx from the node. For more information, see Decommission a Portworx node in Kubernetes.
- Remove the Portworx DaemonSet: When you remove the Portworx DaemonSet, the Portworx containers are removed from your worker nodes. However, the Portworx configuration files remain on the worker nodes and the storage devices, and the data volumes are still intact. You can use the data volumes again if you restart the Portworx DaemonSet and containers by using the same configuration files. For more information, see Removing the Portworx DaemonSet.
- Remove Portworx from your cluster: If you want to remove Portworx and all your data from your cluster, follow the steps to remove Portworx from your cluster.
Removing the Portworx DaemonSet
When you remove the Portworx DaemonSet, the Portworx containers are removed from your worker nodes. However, the Portworx configuration files remain on the worker nodes and the storage devices, and the data volumes are still intact. You can use the data volumes again if you restart the Portworx DaemonSet and containers by using the same configuration files.
Before you begin: Access your Red Hat OpenShift cluster.
- Clone the
ibmcloud-storage-utilities
repo.git clone https://github.com/IBM/ibmcloud-storage-utilities.git
- Change directories to the
px-utils/px_cleanup
directory.cd ibmcloud-storage-utilities/px-utils/px_cleanup
- Run the
px_cleanup.sh
script to remove the DaemonSet from your cluster.sh ./px_cleanup.sh
Removing Portworx from your cluster
To stop billing for Portworx, you must remove the Portworx installation from your cluster and remove the Portworx service instance from your IBM Cloud account.
The following steps remove Portworx from your cluster, including all storage volumes and the data on those volumes.
-
Follow the Portworx documentation to uninstall Portworx.
-
Clean up for your Portworx volume attachments, PVCs, and PVs.
-
List your volume attachments.
kubectl get volumeattachments
-
Delete the Portworx volume attachments.
kubectl delete volumeattachments ATTACHMENT-NAME
-
Delete the PVC that starts with name
px-do-not-delete
.kubectl delete pvc px-do-not-delete-*** -n PORTWOX-NAMESPACE
-
Delete the PVs that were created for Portworx and are in the
Released
state.kubectl delete pv PV-NAME
-
-
Remove the Portworx service instance from your IBM Cloud account.
- From the IBM Cloud resource list, find the Portworx service that you created.
- From the actions menu, click Delete.
- Confirm the deletion of the service instance by clicking Delete.