Using Container Storage
When using container storage, you need to create a PersistentVolumeClaim (PVC). A PVC manages container storage volumes in multiple clouds in a unified manner. The volumes can be mounted to containers based on actual requirements, ensuring high reliability of applications. After a multi-cluster PVC is created on the MCP console, a PVC with the same name is created in all deployed clusters. After you modify or delete a multi-cluster PVC on the cluster console, a message is displayed indicating that the operation is successful. However, MCP will automatically re-create the PVC.
A non-CCE cluster must support the container storage functions. Run the following command to query the StorageClass configuration and the interconnected backend storage service of the cluster. For more information about StorageClass, see Storage Classes.
kubectl get storageclass
Creating a PVC
- Log in to the MCP console. In the navigation pane, choose PVCs. On the page displayed, click Create PVC.
- Specify basic information.
- Name: Enter the name of a PVC to be added. The name must be unique.
- Namespace: Namespace to which the PVC belongs. If you do not specify this parameter, the value default is used by default.
- Cluster: Select the cluster where the PVC is to be deployed.
Figure 1 Selecting a cluster
- Click Next and select a creation mode. Two creation modes are supported: Dynamic and Standard NFS.
- Customize cluster configurations.
- If you select Dynamic, set the parameters listed in Table 1.
Table 1 Parameters for dynamically creating a PVC Parameter
Description
File System Source
If a HUAWEI CLOUD cluster is selected, this parameter can be set to one of the following values:
- EVS: block storage volumes. You can mount EVS volumes to a container path. When the container is migrated, the mounted EVS volume is migrated together. This storage class is applicable when data needs to be stored permanently.
- OBS: object storage volumes. You can create OBS object storage volumes and mount them to a container path. Object storage applies to scenarios such as cloud workload, data analysis, content analysis, and hotspot objects.
- SFS: file system volumes. You can create SFS volumes and mount them to a container path. The volumes created by the underlying SFS service can also be used. SFS volumes apply to workload scenarios where data needs to be persisted and read by and written to multiple nodes. Such scenarios include media processing, content management, big data analysis, and workload analysis.
If a third-party cluster is selected, this parameter can be set only to Other.
Type
This parameter is valid only when File System Source is set to Other. The storage class supported by the cluster depends on the actual environment of the cluster.
Size (GB)
Capacity of the storage to be created.
Access Mode
- If File System Source is set to EVS, Access Mode must be set to ReadWriteOnce, that is, the volume can be mounted as read-write by only a single node.
- If File System Source is set to OBS or SFS, Access Mode must be set to ReadWriteMany, that is, the volume can be mounted as read-write by multiple nodes.
- If the selected cluster is a third-party cluster, the access mode can be ReadWriteOnce or ReadWriteMany.
Annotations
Annotations are attached to PVCs in the form of key-value pairs.
- Click Add Annotations.
- Set Key and Value.
- If you select Standard NFS, set the parameters listed in Table 2.
Table 2 Parameters for creating a PVC using standard NFS Parameter
Description
Access Mode
Set this parameter to ReadWriteMany, that is, the volume can be attached as read-write by multiple nodes.
Mount Point Address
Enter the address of an existing storage server in the format of IP address (for example, 192.168.0.0) or domain name (for example, www.hws.com).
Mount Point Path
Enter the shared directory of an existing storage device. The value must be an absolute path, for example, /dir.
- If you select Dynamic, set the parameters listed in Table 1.
- Click Create. After the PVC is created, click Back to PVC List to view the PVC status.
Using Cloud Volumes
- After you add a container by referring to Deployments, choose Data Storage > Cloud Volume, and then click Add Cloud Volume.
- Configure parameters.
Table 3 Parameters for mounting a file system Parameter
Description
Type
- File storage (NFS)
- Other
PVC Name
Select a created PVC. If no PVC is available, create a PVC first. You can also create a PVC in advance. For details about how to create a PVC, see Creating a PVC.
NOTICE:- If you select an existing PVC, the selected PVC cluster must be the same as the cluster where the workload is deployed. Otherwise, the workload pods fail to be scheduled and the PVC cannot be found.
- The selected PVC must exist and be available. Otherwise, the workload will fail to mount volumes.
Add Container Path
- Set subPath to a path of the data volume in the Kubernetes. It is the subpath of the volume instead of the root path. If this parameter is left empty, the root path is used by default. Currently, only NFS supports subpath.
- Set Container Path to a path to which the file system is mounted. You can click Add Container Path to add multiple paths. NOTICE:
- The container path cannot be a system directory, such as / or /var/run. Otherwise, the container may not function properly. You are advised to mount an empty directory into the container. If the directory is not empty, ensure that the directory does not contain any files that affect container startup. Otherwise, the files will be replaced, making it impossible for the container to be properly started. As a result, the workload creation will fail.
- If the file system is mounted to a high-risk directory, you are advised to use an account with minimum permissions to start the container; otherwise, high-risk files on the host machine may be damaged.
- Set permissions.
- Read-only: You can only read the file system mounted to the path.
- Read/Write: You can modify the file system mounted to the path. Newly written data is not migrated during container migration, which may cause data loss.
- Click OK.
Related Operations
| Operation | Description |
|---|---|
| Deleting a PVC |
|
| Viewing a YAML file | Click View YAML in the Operation column of the target PVC. |
| Viewing events | View the event information about the PVC. NOTE: Event data will be retained for 1 hour and then automatically deleted. |
Last Article: Federated PVCs
Next Article: Namespaces
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.