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

Global flags

This command supports the following global flags:

Flag Description
--kubeconfig Path to the kubeconfig file to use for CLI requests.
--quiet Suppress 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:

Resource Name Description
Namespace directpv Contains all DirectPV components.
DaemonSet node-server Node-level drive management.
Deployment controller Central controller for volume provisioning.
CSIDriver directpv-min-io CSI driver registration.
StorageClass directpv-min-io Default StorageClass for DirectPV volumes.
ServiceAccount, Roles, Bindings directpv-min-io RBAC 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 can no longer access DirectPV volumes.
  • CRDs may be retained: Custom Resource Definitions (drives, volumes) may remain in the cluster.

Before uninstalling

Before uninstalling DirectPV, consider:

  1. Stop workloads: Terminate pods using DirectPV volumes to avoid disruption.
  2. Backup data: Copy important data from DirectPV volumes if needed.
  3. Remove volumes: Delete PersistentVolumeClaims using the directpv-min-io StorageClass.

Reinstalling DirectPV

To reinstall DirectPV after uninstalling:

  1. Run kubectl directpv install.
  2. Run kubectl directpv discover to detect drives.
  3. Review the generated drives.yaml file.
  4. Run kubectl directpv init to reinitialize drives.
Previously initialized drives
Drives that were previously initialized by DirectPV may show existing filesystems during discovery. Use --all with the discover command to see these drives.