kubectl directpv list volumes
The kubectl directpv list volumes command displays information about volumes provisioned and managed by DirectPV.
Use this command to view volume status, capacity, pod assignments, and custom labels.
For information on volume operations, see Managing Volumes.
Syntax
Aliases
The following aliases have the same function:
kubectl directpv list volumekubectl directpv list vol
Parameters
--all
Optional
List all volumes regardless of status.
By default, the output includes only volumes in ready status when you do not specify other selection flags .
--nodes
Optional
Filter output by node names. Specify multiple nodes as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
Short form: -n
--drives
Optional
Filter output by drive names. Specify multiple drives as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
Short form: -d
--drive-id
Optional
Filter output by drive IDs. Specify multiple IDs as a comma-separated list or by repeating the flag.
--pod-names
Optional
Filter output by pod names. Specify multiple names as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
--pod-namespaces
Optional
Filter output by pod namespaces. Specify multiple namespaces as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
--status
Optional
Filter output by volume status. Specify multiple statuses as a comma-separated list or by repeating the flag.
Valid values: pending, ready
--labels
Optional
Filter output by volume labels.
Supports comma-separated key=value pairs.
When specifying multiple labels, volumes must match all labels (AND logic).
--show-labels
Optional
Display custom labels as an additional column in the output.
--pvc
Optional
Display the Persistent Volume Claim (PVC) name as an additional column in the output.
--output
Optional
Set the output format.
Valid values: json, yaml, wide
Short form: -o
--no-headers
Optional
Omit column headers from the output.
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 error messages. |
Examples
List all volumes
Include volumes in all states:
kubectl directpv list volumes --all
Filter by node and drive
Use ellipsis expansion to filter by multiple nodes and drive names:
kubectl directpv list volumes --nodes=node{1...4} --drives=sd{a...f}
Filter by pod
Filter volumes by the pods using them:
kubectl directpv list volumes --pod-names=minio-{0...3} --pod-namespaces=default
Filter by status or label
List pending volumes or filter by custom labels:
kubectl directpv list volumes --status=pending
kubectl directpv list volumes --labels tier=hot
Display extended information
Show PVC names, labels, and additional details:
kubectl directpv list volumes --all --pvc --show-labels --output wide
Export to YAML or JSON
Output volume data for scripting or backup purposes:
kubectl directpv list volumes --output yaml
Behavior
Default filtering
By default, the command only lists volumes in ready status.
Use --all to see volumes in all statuses, or use other selection flags like --nodes, --drives, or --status.
Output columns
| Column | Description |
|---|---|
VOLUME |
Unique volume name (typically matches the PV name) |
CAPACITY |
Volume size |
NODE |
Kubernetes node where the volume is located |
DRIVE |
Device name where the volume is allocated |
PODNAME |
Name of the pod using the volume |
PODNAMESPACE |
Namespace of the pod using the volume |
STATUS |
Current volume status |
With --output wide:
| Column | Description |
|---|---|
DRIVE ID |
Unique identifier for the drive hosting the volume |
With --pvc:
| Column | Description |
|---|---|
PVC |
Name of the Persistent Volume Claim bound to the volume |
With --show-labels:
| Column | Description |
|---|---|
LABELS |
Custom labels assigned to the volume |
Status values
| Status | Description |
|---|---|
Pending |
Volume is waiting to be bound |
Ready |
Volume is provisioned and available |
Bounded |
Volume is bound to a PVC and in use by a pod |
Released |
Volume’s PVC has been deleted |
Lost |
Volume’s underlying drive is no longer accessible |
Additional status flags may appear:
Suspended- Volume is suspended for maintenanceDeleting- Volume is being deleted
Selection logic
When you specify multiple selection flags, DirectPV shows only volumes that match all criteria (AND logic).
For example, --nodes=node1 --status=ready shows only volumes on node1 that are also in ready status.