IBM Cloud Docs
Removing Portworx

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.

  1. 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.

    kubectl 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
    
  2. Review the ReclaimPolicy for the storage class.

    kubectl 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 says Retain, 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.

  3. Remove any pods that mount the PVC.

    1. List the pods that mount the PVC.

      kubectl 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.

    2. Remove the pod that uses the PVC.

      If the pod is part of a deployment, remove the deployment.

      kubectl delete pod <pod_name>
      
    3. Verify that the pod is removed.

      kubectl get pods
      
  4. Remove the PVC.

    kubectl delete pvc <pvc_name>
    
  5. Review the status of your PV. Use the name of the PV that you retrieved earlier as VOLUME.

    kubectl 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 a Released state, if you must manually delete the PV. Note: For PVs that are automatically deleted, the status might briefly say Released before it is deleted. Rerun the command after a few minutes to see whether the PV is removed.

  6. If your PV is not deleted, manually remove the PV.

    kubectl delete pv <pv_name>
    
  7. Verify that the PV is removed.

    kubectl get pv
    
  8. 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 kubectl get pods -n kube-system | grep portworx.

    kubectl exec <portworx-pod>  -it -n kube-system -- /opt/pwx/bin/pxctl volume list
    
  9. If your Portworx volume is not removed, manually remove the volume.

    kubectl 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: Log in to your account. If applicable, target the appropriate resource group. Set the context for your cluster.

  1. Clone the ibmcloud-storage-utilities repo.
    git clone https://github.com/IBM/ibmcloud-storage-utilities.git
    
  2. Change directories to the px-utils/px_cleanup directory.
    cd ibmcloud-storage-utilities/px-utils/px_cleanup
    
  3. 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.

  1. Follow the Portworx documentation to uninstall Portworx.

  2. Clean up for your Portworx volume attachments, PVCs, and PVs.

    1. List your volume attachments.

      kubectl get volumeattachments
      
    2. Delete the Portworx volume attachments.

      kubectl delete volumeattachments ATTACHMENT-NAME
      
    3. Delete the PVC that starts with name px-do-not-delete.

      kubectl delete pvc px-do-not-delete-*** -n PORTWOX-NAMESPACE
      
    4. Delete the PVs that were created for Portworx and are in the Released state.

      kubectl delete pv PV-NAME
      
  3. Remove the Portworx service instance from your IBM Cloud account.

    1. From the IBM Cloud resource list, find the Portworx service that you created.
    2. From the actions menu, click Delete.
    3. Confirm the deletion of the service instance by clicking Delete.