Create a PV
Manually create static PVs of type HostPath or NFS shared storage.
-
HostPath: Mounts the file directory of the host machine where the container is running to a specified path in the container (corresponding to Kubernetes’ HostPath), allowing the container to use the host machine’s file system for persistent storage. If the host machine becomes unavailable, the HostPath may not be accessible.
-
NFS Shared Storage: NFS shared storage uses the community NFS CSI (Container Storage Interface) storage plugin, which is more aligned with the design principles of Kubernetes and provides client access capabilities for multiple servers. Before using it, please make sure that the current cluster has deployed the NFS storage plugin.
Prerequisites
-
Confirm the capacity of the PV to be created and ensure that the backend storage currently has the capability to provide the corresponding storage capacity.
-
Obtain the access address of the backend storage, the file path to be mounted, and the credentials for access (if required).
Procedure of operation
-
In the left navigation bar, click Storage > PV (Persistent Volumes).
-
Click Create a PV.
-
Refer to the following instructions and configure the parameters, then click Create.
Storage parameters
| Type | Parameter | Description |
|---|---|---|
| HostPath | path | The path of the file directory on the node that serves as the backend storage volume. For example: /etc/kubernetes. |
| NFS Shared Storage | Server Address | The access address of the NFS server. |
| Path | The mount path of the NFS file system on the server node, for example: /nfs/data. |
|
| NFS Protocol Version | The NFS protocol versions supported by the platform are v3, v4.0, and v4.1. You can execute nfsstat -s on the server side to view the version information. |
Access mode
The access mode of PV is influenced by the relevant parameters settings of the backend storage.
| Access Mode | Meaning |
|---|---|
| Single Node Read/Write (RWO) | Can be mounted in read/write mode by a single node. |
| Multi-Node Read/Write (RWX) | Can be mounted in read/write mode by multiple nodes. |
| Multi-Node Read-Only (ROX) | Can be mounted in read-only mode by multiple nodes. |
Recycle Strategy
| Reclaim Policy | Meaning |
|---|---|
| Delete | When a PV claim is deleted, the bound PV and the underlying storage volume resources are also deleted. Note: The Delete reclaim policy is not supported for NFS shared StorageClasses PVs. |
| Retain | Even if a PV claim is deleted, the bound PV and the stored data will still be retained. Manual handling of the stored data and manual deletion of the PV will be required. |
Relevant operations
You can click on the
on the right side of the list page or click on the Actions in the upper right corner of the details page to update or delete the PV as needed.
Deleting a Persistent Volume (PV) is applicable in the following two scenarios:
-
Delete unbound PVs: PVs that have never been written to and no longer need to be written to can be deleted to free up the corresponding storage space.
-
Delete reclaimable PV: The PV claim has been deleted, but the PV itself has not been deleted because the reclaim policy is set to “retain”. If the data in the PV has been saved to another storage or is no longer needed, deleting it will free up the corresponding storage space.