百度智能云

All Product Document

          Cloud-Native Application Platform CNAP

          Storage Volume Management

          The characteristics of the container determine that the container itself is non-persistent, the container is deleted, and the data on it is also deleted. Baidu cloud storage service can solve the problem of container data sharing and persistent storage. It is suitable for big data analysis, media, games and many other scenarios. CNAP storage volume management can mount storage volumes for the containers in your deployment group to achieve container data persistence.

          Storage Type

          Local storage Description
          Local storage Including: Host temporary path (EmptyDir), HostPath
          File storage CFS Mount CFS cloud file storage for the container by creating PV/PVC

          Currently, CNAP storage volume management supports mounting local storage volume types and mounting CFS cloud file storage for users through PV/PVC. Local storage volumes include: Host temporary path (EmptyDir), HostPath.

          PV ( PersistenVolume) and PVC (PersistentVolumeClaim) are API resources provided by Kubernetes for abstracting storage details. CNAP storage volume management creates PV and PVC resources in the cluster, and mounts Baidu AI Cloud CFS storage volumes as storage volumes to the container without paying attention to the details of the underlying implementation, thus more conveniently providing a persistent storage solution for the container cluster.

          Use Local Storage

          Mount storage volume when creating application/deployment group

          You can mount storage volumes for deployment groups when creating applications (except empty applications) or creating new deployment groups under applications.

          Mount storage volume when creating application

          1. Application creation
          2. Enter information about the deployment group
          3. Click Add Storage Volume on the Storage Volume page

          image.png

          Mount the storage volume when creating a deployment group

          1. Create a deployment group under the application
          2. Enter information about the deployment group
          3. Click Add Storage Volume on the Storage Volume interface

          Edit the storage volume mount in the deployment group

          On the "Deployment Group Details" page, you can view the storage volume mounting status of the containers in the current deployment group, and click "Update" to edit the storage volume mounting status of the deployment group.

          Mount storage volume

          In the "Add Storage Volume" interface, you can select the type of storage volume mounted in the container: HostPath or EmptyDir.

          Host path:

          image.png

          EmptyDir:

          image.png

          Enter the corresponding information according to the selected storage volume type. The HostPath type needs to enter "host storage path", which means the real path of the host.

          In the "Storage Volume Mount" section, you can mount the storage volume in each container of the deployment group. You can choose and enter as needed:

          1. Container name: Select the container to mount the storage volume, which is required.
          2. Mount path: The mounting path of the storage volume in the container. After the mounting is successful, the storage volume can be accessed in the container through this path, which is required.
          3. Subpath: By creating a new subdirectory under the host path, access isolation is achieved among multiple containers mounted with the same storage volume, which is not sensitive to containers. It is optional and empty by default.
          4. Is it read only Choose whether to mount the storage volume with read-only privilege. This is optional, and not selected by default

          HostPath

          The HostPath type storage volume can mount the host path to the container for access. After the deployment group is deleted, the data in the storage volume will be retained on the host, so you need to enter the host path in the "host storage path". Optional host path storage volume "types" include:

          1. DirectoryOrCreate: If the specified path does not exist, an empty directory will be created, and the privilege will be set to 0755, which has the same user group and ownership as Kubelet.
          2. Directory: The specified path must be an existing directory. (If it does not exist, the container cannot be started).
          3. FileOrCreate: If the specified path does not exist, an empty file will be created, and the privileges will be set to 0644, which has the same user group and ownership as Kubelet.
          4. File: The specified path must be an existing file. (If it does not exist, the container cannot be started).
          5. Socket: The specified path must be an existing UNIX socket file. (If it does not exist, the container cannot be started).
          6. CharDevice: The specified path must be an existing character device. (If it does not exist, the container cannot be started).
          7. BlockDevice: The specified path must be an existing block device. (If it does not exist, the container cannot be started).

          Where, only when DirectoryOrCreate or Directory is selected, can you enter "Subpath".

          EmptyDir

          EmptyDir type storage volume can mount the newly created temporary directory on the host to the container for access. It should be noted that when a copy (Pod) is deleted in the deployment, the temporary directory will also be deleted. The user can select the "storage medium" of the temporary path:

          1. Memory: The data will be stored in the memory of the host, with higher access speed, but will occupy the available memory quota of the user container.
          2. Temporary directory: The data will be stored in the host's temporary directory.

          Use Cloud File Storage CFS

          Manage CFS storage volumes

          You can manage your CFS persistent storage volume in the "Storage" option interface in "Resource Management".

          image.png

          New storage volume

          After determining your target workspace, click "New Storage Volume" to start creating a new persistent storage volume.

          image.png

          To create a new storage volume, enter basic information, including: Storage volume name, environment, and determine the cluster. If the environment you selected is not bound to the CCE cluster, you can click "Bind Cluster" to associate the environment with the cluster.

          Creating a new storage volume requires you to create a CFS instance in Baidu AI Cloud CFS File Storage Service, and create a new mount point with the cluster same PVC under the CFS instance. To make it easier for you to select the correct VPC when creating a mount point, CNAP prompts the VPC of the cluster after you select the cluster.

          After you create a new CFS instance and mount point in the Baidu AI Cloud CFS cloud file storage service, you can view the CFS file system and mount point information that can be mounted to the target cluster on the CNAP New Storage Volume page.

          The access mode supported by persistent storage volumes is: ReadWriteMany means that you can mount the newly created storage volume to multiple deployment groups in the cluster or multiple containers in a deployment group.

          The data retention policy supported by persistent storage volumes is: Retain means that when you cancel the mounting of the storage volume in the container, or delete the storage volume on the CNAP platform, the data that has been written into the CFS will not be deleted, to prevent the data from being accidentally lost. You can still access the written data directly through the CFS mount point.

          After clicking OK, CNAP will create one-to-one bound PV/PVC for you in the cluster.

          View storage volume mount details

          After creating a new storage volume, determine the workspace, and you can see all storage volumes in the workspace in the storage volume list. The storage volume list shows the basic information of the storage volume, including the name, environment name/ID, cluster name/ID, the cloud CFS mount point corresponding to the storage volume, and the creation time of the storage volume.

          If you have mounted a storage volume to one or more deployment groups, click the "Mount Details" button, and the right pop-up window will display the storage volume's mounting information. It includes the environment ID/name, application ID/name, deployment group ID/name under the workspace. You can redirect to the deployment group details page by clicking the deployment group ID/name.

          Delete storage volume

          In the storage volume list, you can delete the storage volume by clicking the "Delete" button on the right side of the storage volume.

          If the deleted storage volume is not mounted by any storage volume, click the "Delete" button to complete the deletion of the storage volume; if the storage volume has been mounted, the storage volume will not be deleted immediately. Instead, it enters the "Deleting" state. You need to view the "Mount Details" and delete the storage volume in all the displayed deployment groups. After deleting the mount, the storage volume will be deleted. At the same time, the PV/PVC in the cluster is also deleted.

          Mount CFS storage volume

          CFS storage volumes and mounting methods are similar to local storage volumes. You can mount storage volumes for the deployment group when creating applications and deployment groups. You can also edit the deployment group's mount information on the "Deployment Group Details" page.

          Click "Add Storage Volume" to select the CFS storage volume you want to mount and the mount target container in the pop-up window.

          image.png

          In the "Select Storage Volume" list, all storage volumes available for the deployment group will be displayed. You can mount the storage volume whose status is "Available" to the container.

          When mounting a storage volume to multiple containers or deployment groups, if you want to prevent multiple containers from reading and writing, causing data errors in the storage volume, you can set the mount "Subpath" or enable the "Read-Only" option, and assign different directories and read privileges to different containers or deployment groups.

          Previous
          Access Mode Management
          Next
          Change Management