Manage Distributed File Storage Volumes
How to manage, optimize, and maintain distributed file storage 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:- ReadWriteManyresources: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.
Managing PVCs
For creation, both API and Console approaches are common. For ongoing management tasks, the Console provides easier visualization and safety checks, so we focus on Console methods below.
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.
PVCs can't be reduced in size. To use a smaller volume, you'll need to create a new, smaller PVC and migrate your data manually.
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.
Performance Optimization
Git Performance
Git performance with Distributed File Storage can sometimes be slower than desired. Here are some best practices to enhance its performance on Distributed File Storage.
Enable parallel checkout
Enable parallel checkout by setting a desired number of parallel workers in your Git config (checkout.workers
). The recommended number for working with Distributed File Storage is 16
.
$git config --global checkout.workers 16
Enable untracked cache
Enable Git's untracked cache.
$git config --global core.untrackedCache true
Define record sizes for TAR performance
When using TAR (tar
) for compression, it may help performance to set the record size to 1M
:
$tar --record-size=1M -cf archive.tar foo
Setting the record size can also make rsync
more efficient. See the man
page for tar
for more information.