DirectPV CLI

DirectPV provides a kubectl plugin for managing DirectPV drives and volumes. Use this plugin at the command line to complete all of the functions required for adding, managing, scheduling, and removing DirectPV drives and volumes in a Kubernetes cluster.

Install Kubectl plugin

The directpv kubectl plugin can be used to manage the lifecycle of volumes and drives in a Kubernetes cluster.

Run the following command to install the DirectPV plugin:

kubectl krew install directpv
For more complete instructions on installing DirectPV, including installing with a binary instead of using krew, see the installation page.

Usage

If installed with krew, use

kubectl directpv [command] [flags]

If installed as a binary, use

kubectl-directpv [command] [flags]

Flags

The following flags are available for kubectl directpv and many of the commands included with the plugin.

Flag Description
-h, --help help for directpv
--kubeconfig string Path to the kubeconfig file to use for CLI requests
--quiet Suppress printing error messages
--version version for directpv

Available Commands

This documentation includes details for each available command on separate subpages. The available commands include:

Command Description
Install
install Install DirectPV in Kubernetes
Manage Drives and Volumes
discover Discover new drives
info Show information about DirectPV installation
init Initialize drives
label drives Set labels to drives
label volumes Set labels to volumes
list-drives List drives
list-volumes List volumes
resume-drives Resume suspended drives
resume-volumes Resume suspended volumes
suspend-drives Suspend drives
suspend-volumes Suspend volumes
Manage Scheduling
cordon Mark drives as unschedulable
uncordon Mark drives as schedulable
Maintenance
clean Cleanup stale volumes
migrate Migrate drives and volumes from legacy DirectCSI
move Move volumes excluding data from source drive to destination drive on a same node
remove Remove unused drives from DirectPV
Uninstall DirectPV
uninstall Uninstall DirectPV in Kubernetes

Command History

DirectPV Command changes

Old DirectPV Command Replacement DirectPV Command
kubectl directpv discover kubectl directpv init

Command changes from DirectCSI

DirectCSI Command DirectPV Command
kubectl directcsi drives list kubectl directpv list drives
kubectl directcsi volumes list kubectl directpv list volumes
kubectl directcsi format kubectl directpv discover, then kubectl directpv init