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

List all volumes in ready status:

kubectl directpv list volumes

Output:

┌─────────────────────────────────────────┬──────────┬───────┬───────┬───────────┬──────────────┬─────────┐
│ VOLUME                                  │ CAPACITY │ NODE  │ DRIVE │ PODNAME   │ PODNAMESPACE │ STATUS  │
├─────────────────────────────────────────┼──────────┼───────┼───────┼───────────┼──────────────┼─────────┤
│ pvc-a1b2c3d4-e5f6-7890-abcd-ef123456    │ 10 GiB   │ node1 │ sdb   │ minio-0   │ default      │ Bounded │
│ pvc-b2c3d4e5-f6a7-8901-bcde-f1234567    │ 10 GiB   │ node1 │ sdc   │ minio-1   │ default      │ Bounded │
│ pvc-c3d4e5f6-a7b8-9012-cdef-12345678    │ 10 GiB   │ node2 │ sdb   │ minio-2   │ default      │ Ready   │
└─────────────────────────────────────────┴──────────┴───────┴───────┴───────────┴──────────────┴─────────┘
kubectl directpv list volumes [VOLUME ...]              \
                              [--all]                   \
                              [-d|--drives "string"]    \
                              [--drive-id "string"]     \
                              [--labels "string"]       \
                              [-n|--nodes "string"]     \
                              [--pod-names "string"]    \
                              [--pod-namespaces "string"] \
                              [--pvc]                   \
                              [--show-labels]           \
                              [--status "string"]
  • VOLUME filters output to specific volume names.
  • Brackets [] indicate optional parameters.

Aliases

The following aliases have the same function:

  • kubectl directpv list volume
  • kubectl 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:

FlagDescription
--kubeconfigPath to the kubeconfig file to use for CLI requests.
--quietSuppress 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

ColumnDescription
VOLUMEUnique volume name (typically matches the PV name)
CAPACITYVolume size
NODEKubernetes node where the volume is located
DRIVEDevice name where the volume is allocated
PODNAMEName of the pod using the volume
PODNAMESPACENamespace of the pod using the volume
STATUSCurrent volume status

With --output wide:

ColumnDescription
DRIVE IDUnique identifier for the drive hosting the volume

With --pvc:

ColumnDescription
PVCName of the Persistent Volume Claim bound to the volume

With --show-labels:

ColumnDescription
LABELSCustom labels assigned to the volume

Status values

StatusDescription
PendingVolume is waiting to be bound
ReadyVolume is provisioned and available
BoundedVolume is bound to a PVC and in use by a pod
ReleasedVolume’s PVC has been deleted
LostVolume’s underlying drive is no longer accessible

Additional status flags may appear:

  • Suspended - Volume is suspended for maintenance
  • Deleting - 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.

On this page