kubectl directpv suspend volumes
The kubectl directpv suspend volumes command suspends volumes and marks them as read-only.
Suspending a volume mounts it to an empty temporary directory, allowing StatefulSet pods to start even when the volume data is unavailable.
To restore normal operation, use kubectl directpv resume volumes.
For information on volume operations, see Managing Volumes.
Syntax
Aliases
The following aliases have the same function:
kubectl directpv suspend volumekubectl directpv suspend vol
Parameters
VOLUME
Optional
The name of one or more volumes to suspend.
Specify multiple volume names separated by spaces.
Use kubectl directpv list volumes to find volume names.
--dangerous
Required
Confirms that you understand suspending volumes makes them read-only. The command does not run without this flag.
--nodes
Optional
Suspend volumes on specific nodes. Specify multiple nodes as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
Short form: -n
--drives
Optional
Suspend volumes on specific drives by name. Specify multiple drives as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
Short form: -d
--pod-names
Optional
Suspend volumes by pod name. Specify multiple names as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
--pod-namespaces
Optional
Suspend volumes by pod namespace. Specify multiple namespaces as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
--dry-run
Optional
Display what volumes would be suspended without making changes.
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
Suspend a volume by name
Suspend a specific volume:
kubectl directpv suspend volumes pvc-0700b8c7-85b2-4894-b83a-274484f220d0 --dangerous
Suspend all volumes on a node
Suspend all volumes on node1:
kubectl directpv suspend volumes --nodes=node1 --dangerous
Suspend volumes on a specific drive
Suspend all volumes on drive sda on node1:
kubectl directpv suspend volumes --nodes=node1 --drives=sda --dangerous
Preview suspend operation
Check which volumes would be suspended without making changes:
kubectl directpv suspend volumes --nodes=node1 --dry-run
Behavior
Why suspend volumes?
By Kubernetes design, an active StatefulSet workload requires that all of its Pods are in a running state. A faulty volume prevents the StatefulSet from starting.
Suspending a volume provides a workaround by mounting it to an empty temporary directory (/var/lib/directpv/tmp) with read-only access.
This allows the StatefulSet to start while addressing the underlying issue.
What happens when suspending a volume?
When you suspend a volume:
- DirectPV remounts the volume to an empty temporary directory.
- The volume becomes read-only.
- The volume status shows
Suspended. - StatefulSet Pods using the volume can start (with read-only data access).
Selection requirements
You must specify at least one selection method:
- One or more
VOLUMEarguments --nodesflag--drivesflag--pod-namesflag--pod-namespacesflag
When you specify multiple selection flags, DirectPV suspends only volumes that match all criteria (AND logic).
Verify volume status
After suspending, verify the volume status:
kubectl directpv list volumes --all
Suspended volumes show Suspended in their status.
After maintenance
After completing maintenance or repair:
- Resume the volume using
kubectl directpv resume volumes. - Verify volume status using
kubectl directpv list volumes.