kubectl directpv uninstall

The kubectl directpv uninstall command removes DirectPV components from your Kubernetes cluster.

Data considerations

Uninstalling DirectPV removes the CSI driver and management components. Existing data on initialized drives remains intact but becomes inaccessible to Kubernetes workloads.

Syntax

Uninstall DirectPV from the cluster:

kubectl directpv uninstall

Output:

DirectPV uninstalled successfully
kubectl directpv uninstall

Global flags

This command supports the following global flags:

FlagDescription
--kubeconfigPath to the kubeconfig file to use for CLI requests.
--quietSuppress printing output messages.

Examples

Uninstall DirectPV

Remove DirectPV from the cluster:

kubectl directpv uninstall

Silent uninstall

Uninstall without output (useful in scripts):

kubectl directpv uninstall --quiet

Behavior

Components removed

The uninstall command removes the following Kubernetes resources:

ResourceNameDescription
NamespacedirectpvContains all DirectPV components.
DaemonSetnode-serverNode-level drive management.
DeploymentcontrollerCentral controller for volume provisioning.
CSIDriverdirectpv-min-ioCSI driver registration.
StorageClassdirectpv-min-ioDefault StorageClass for DirectPV volumes.
ServiceAccount, Roles, Bindingsdirectpv-min-ioRBAC configuration.

What happens to data

When you uninstall DirectPV:

  • Drive data is preserved: Data on initialized drives remains on the physical disks.
  • Volumes become inaccessible: Kubernetes workloads cannot access DirectPV volumes until you reinstall DirectPV.
  • Drive and volume records are kept: The custom resource definitions and the DirectPV drive, volume, node, and initialization request objects stay in the cluster.

Before uninstalling

Before uninstalling DirectPV, consider:

  1. Stop workloads: Terminate pods using DirectPV volumes to avoid disruption.
  2. Back up data: Copy important data from DirectPV volumes if needed.

Keep the PersistentVolumeClaims

Do not delete PersistentVolumeClaims that use the directpv-min-io StorageClass if you want to keep their data. This StorageClass uses the Delete reclaim policy, so deleting a PersistentVolumeClaim deletes its volume and the data on it.

Reinstalling DirectPV

To reinstall DirectPV after uninstalling, run kubectl directpv install. DirectPV finds the drives and volumes it managed before, because their records stay in the cluster.

Do not initialize previously used drives

Do not run kubectl directpv init on drives that DirectPV managed before. The init command formats a drive and erases all data on it. Use kubectl directpv discover and init only to add new, empty drives.

On this page