Manage Storage Volumes
How to manage Storage Volumes as Persistent Volumes on CKS
On CKS, Storage Volumes are created as Persistent Volumes (PVs), by deploying Persistent Volume Claims (PVCs).
Specifying the type, size, and placement of Storage Volumes is accomplished by configuring the manifest for the Persistent Volume Claim.
Persistent Volume Claims
Persistent Volume Claims are requests for Persistent Volume resources, which are used as storage volumes for workloads that require persistent storage for workloads.
Create PVCs
Create a PVC by clicking the PVC icon in the Cloud Console sidebar, or via the API by deploying a PVC manifest.
Create a PVC using the API
Create a Persistent Volume Claim by annotating the following YAML manifest to your specifications:
apiVersion: v1kind: PersistentVolumeClaimmetadata:name: new-pvcnamespace: defaultspec:accessModes:- ReadWriteOnceresources:requests:storage: 1GistorageClassName: shared-vast
Update these fields in the manifest:
Field name | Field type | Description |
---|---|---|
name | string | The name of the PVC. |
namespace | string | The namespace for the PVC. |
spec.accessModes | list | Sets the access mode for the volume. Distributed Filesystem Volumes use ReadWriteMany . |
resources.requests.storage | string | Determines the size of the volume, in Gi |
storageClassName | string | The storage class name is shared-vast for CKS. |
Configure the manifest as desired, save it to a .yaml
file, and apply it with kubectl
:
$kubectl apply -f my-pvc.yaml
To verify that the PVC is bound to a PV, run:
$kubectl get pvc my-pvc
Output:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEmy-PVC Bound pvc-b657b567-e-6b78-98347-67894349850 512Gi RWO shared-vast 1d
If desired, users can get more detailed information about the PVCs they have created by running the following command:
$kubectl describe pvc my-pvc
Create a PVC with the Cloud Console
If no clusters exist, or the user has no access to any clusters, the following message is shown on the PVC dashboard.
If an active cluster is available, choose Create a PVC to begin.
Enter details for the PVC, then click Create. After the PVC is created, basic information about the PVC, including its name, age, size, and status is shown.
Working with PVCs
The groups a user belongs to dictate the way they interact with PVC resources. Non-admin users may add PVCs through the UI or using the API, but their capacity to access and edit them is limited to their permitted actions within their clusters.
Administrators have comparatively greater powers over PVC resources. Users with admin
, write
, and read
Cluster RoleBindings can add and remove PVCs from the groups they are in. In addition to this, the default admin
privileges allows them to manage those PVCs collectively. They can also use the following Console Actions inside their cluster:
- Edit
RoleBindings
. - Create and modify RBAC schemes which allow a chosen group or groups access to resources. These can be as general as a resource type, or as specific as a particular PVC.
Editing Volumes
To edit a PVC, click the three-dot menu on the far right of the PVCs listing on the Overview page, then click Edit. Enter the desired changes in the pop-up modal.
Cloning PVCs
Users with write
permissions may clone PVCs.
Click the Clone button from the PVC's three-dot menu, and then enter a new name for the cloned PVC. Click Confirm to provision an exact copy of the PVC in the user's default namespace.
Delete a Storage Volume via the Cloud Console
Only users with admin
permissions can delete Storage Volumes.
From the three-dot menu, select Delete.
When a PVC is deleted, any PV linked to it is automatically soft-deleted. Soft-deleted PVs are deleted permanently after the soft delete window (24hrs after the original PVC deletion) expires. To delete a PVC, type the name of the desired volume in the confirmation modal, then click Delete.
The volume is removed from the PVC overview menu when deletion is complete.
Persistent Volume Management Operator
CKS features a Persistent Volume Management Operator (PVMO). PVMO is a Kubernetes controller manager that runs periodically to clean up orphaned volumes.
PVMO tracks PVC delete
events through admission webhooks. If it finds a delete
event, it adds the label pv-failsafe.coreweave.cloud/<deletion-timestamp>
- where deletion-timestamp
is the current time - to the Persistent Volume to which the PVC was attached.
The PVMO also adds a watcher service that periodically lists all Persistent Volumes in the cluster.
By default, the watcher lists all PVs in the cluster once per hour.
The watcher service checks for any "orphaned" PVs. A PV is considered "orphaned" if it has been released from its PVC and does not have the soft delete label described above. If the watcher finds an orphaned PV, it adds the soft delete label to it.
The watcher service also checks Persistent Volumes to see if they are eligible for deletion. To be eligible, a PV must feature the soft delete label, and must have exceeded the soft delete window.
The default soft delete window for PVs is 24 hours.
If both of these conditions are met, the PVMO updates the reclaim policy on the PV from Retain
to Delete
. This update means that the PV gets reclaimed by CKS and all of its underlying volumes are deleted.