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 uninstallOutput:
DirectPV uninstalled successfullykubectl directpv uninstallGlobal 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 uninstallSilent uninstall
Uninstall without output (useful in scripts):
kubectl directpv uninstall --quietBehavior
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 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:
- Stop workloads: Terminate pods using DirectPV volumes to avoid disruption.
- 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.