Updated on 2024-12-16 GMT+08:00

Configuring Data Storage

On-disk files in a container are ephemeral, which presents the following problems to component instances running in the container:

  1. When a container is rebuilt, files in the container will be lost, which does not meet data persistence requirements.
  2. When multiple containers run in a pod at the same time, files need to be shared among the containers, which poses a challenge of ensuring data consistency between container instances.

Setting data storage for container-deployed components can provide persistent storage to ensure data consistency during container restart, migration, or expansion.

Scenario

Table 1 Storage scenarios

Storage Type

Scenario

EVS Disks

EVS supports three specifications: common I/O, high I/O, and ultra-high I/O.

  • Common I/O: The backend storage is provided by the Serial Advanced Technology Attachment (SATA) storage media. Common I/O is applicable to scenarios where large capacity is needed but high read/write rate is not required, and the volume of transactions is low. Examples include development testing and enterprise office applications.
  • High I/O: The backend storage is provided by the Serial Attached SCSI (SAS) storage media. High I/O is applicable to scenarios where relatively high performance, high read/write rate, and real-time data storage are required. Examples include creating file systems and sharing distributed files.
  • Ultra-high I/O: The backend storage is provided by the Solid-State Drive (SSD) storage media. Ultra-high I/O is applicable to scenarios where high performance, high read/write rate, and data-intensive applications are required. Examples include NoSQL, relational database, and data warehouse (such as Oracle RAC and SAP HANA).

SFS File Systems

SFS applies to a wide range of scenarios, including media processing, content management, big data, and workload analysis.

OBS Buckets

  • Standard OBS buckets:

    This type of OBS buckets applies to scenarios where a large number of hotspot files or small-sized files need to be accessed frequently (multiple times per month on average) and data can be quickly obtained. For example, cloud applications, data analysis, content analysis, and hotspot objects.

  • Infrequent access OBS buckets:

    This type of OBS buckets applies to scenarios where data is not frequently accessed (less than 12 times per year on average) but fast access response is required. For example, static website hosting, backup/active archiving, storage resource pools or backup storage for cloud services.

SFS Turbo

SFS Turbo file systems are fast, on-demand, and scalable, which are suitable for DevOps, containerized microservices, and enterprise office applications.

HostPath

The file directory of the host where the application component is located is mounted to the specified mounting point of the application. If the application component needs to access /etc/hosts, use HostPath to map /etc/hosts.

NOTICE:

Do not mount the file directory to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any files that affect the application component instance startup. Otherwise, the file will be replaced, causing application component instance startup exceptions.

EmptyDir

Used for temporary storage. The lifecycle of temporary storage is the same as that of an application component instance. When an application instance disappears, EmptyDir will be deleted and the data is permanently lost.

ConfigMap

Keys in a configuration item are mapped to an application so that configuration files can be mounted to the specified application component directory.

Secret

Sensitive information such as application authentication and application keys is stored in a secret, and the secret is mounted to a specified path of the application component.

EVS Disks

EVS disks cannot be mounted across AZs and cannot be used by multiple workloads, multiple pods of the same workload, or multiple tasks.

  1. Choose Container Settings.
  2. Choose Data Storage > Cloud Storage > Add Cloud Storage and set parameters by referring to Table 2.

    Table 2 EVS disks

    Parameter

    Description

    Type

    Select EVS disk.

    The method of using an EVS disk is the same as that of using a traditional disk. However, EVS disks have higher data reliability and I/O throughput and are easier to use. They apply to file systems, databases, or other system software or workloads that require block storage devices.

    Allocation Mode

    • Manual

      Select an EVS disk PersistentVolumeClaim (PVC).

      You need to statically create an EVS disk PVC and a storage volume in advance. For details, see Using an Existing EVS Disk Through a Static PV.

      The EVS disk PVC and the component instance container must be in the same namespace.

    • Automatic

      Storage is created automatically. You need to enter the storage capacity.

      1. If the storage type is EVS disk, select an AZ for creating the EVS disk first.
      2. Select a storage sub-type.

        High I/O: EVS disks that have high I/O and use SAS.

        Common I/O: EVS disks that use SATA.

        Ultra-high I/O: EVS disks that have ultra-high I/O and use SSD.

      3. Enter the storage capacity, in the unit of GB. Ensure that the storage capacity quota is not exceeded; otherwise, creation will fail.

    Add Container Path

    1. Set Sub-path and Mount Path to the path to which the data storage is mounted.
      For example, if Mount Path is set to /tmp and Sub-path is set to /app, the data volume is mounted to /tmp/app of the application.
      NOTICE:
      • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
      • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.
    2. Set Permission.
      • Read-only: allows you only to read data volumes in the application path.
      • Read/Write: allows you to modify data volumes in the application path. To prevent data loss, newly written data will not be migrated during application migration.

  3. Click OK.

SFS File Systems

  1. Choose Container Settings.
  2. Choose Data Storage > Cloud Storage > Add Cloud Storage and set parameters by referring to Table 3.

    Table 3 SFS file systems

    Parameter

    Description

    Type

    Select SFS.

    SFS applies to a wide range of scenarios, including media processing, content management, big data, and application analysis.

    Allocation Mode

    • Manual

      Select an SFS PVC.

      You need to statically create an SFS PVC and a storage volume in advance. For details, see Using an Existing SFS File System Through a Static PV.

      The SFS PVC and the component instance container must be in the same namespace.

    • Automatic

      Storage is created automatically. You need to enter the storage capacity.

      1. Select a storage sub-type.

        Set the sub-type to NFS.

      2. Enter the storage capacity, in the unit of GB. Ensure that the storage capacity quota is not exceeded; otherwise, creation will fail.

    Add Container Path

    1. Set Sub-path and Mount Path to the path to which the data storage is mounted.
      For example, if Mount Path is set to /tmp and Sub-path is set to /app, the data volume is mounted to /tmp/app of the application.
      NOTICE:
      • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
      • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.
    2. Set Permission.
      • Read-only: allows you only to read data volumes in the application path.
      • Read/Write: allows you to modify data volumes in the application path. To prevent data loss, newly written data will not be migrated during application migration.

  3. Click OK.

OBS Buckets

  1. Choose Container Settings.
  2. Choose Data Storage > Cloud Storage > Add Cloud Storage and set parameters by referring to Table 4.

    Table 4 OBS buckets

    Parameter

    Description

    Type

    Select OBS.

    Standard and Infrequent Access OBS buckets are supported. OBS buckets apply to scenarios such as big data analytics, cloud native application data, static website hosting, and backup/active archiving.

    Allocation Mode

    • Manual

      Select an OBS PVC.

      You need to statically create an OBS PVC and a storage volume in advance. For details, see Using an Existing OBS Bucket Through a Static PV.

      The OBS volume and the component instance container must be in the same namespace.

    • Automatic
      1. Set Secret.

        Namespace is the namespace of the container where the component instance is located and cannot be changed.

        Click Use Existing Secret to select the secret in the namespace of the container where the component instance is located.

        You can also create a secret: Enter a new secret name, click Add Key File, and upload the obtained local secret file. For details about how to obtain the secret file, see Access Keys.

      2. Select a storage sub-type. You can select Standard or Infrequent Access.

    Add Container Path

    1. Set Sub-path and Mount Path to the path to which the data storage is mounted.
      For example, if Mount Path is set to /tmp and Sub-path is set to /app, the data volume is mounted to /tmp/app of the application.
      NOTICE:
      • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
      • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.
    2. Set Permission.
      • Read-only: allows you only to read data volumes in the application path.
      • Read/Write: allows you to modify data volumes in the application path. To prevent data loss, newly written data will not be migrated during application migration.

  3. Click OK.

SFS Turbo

  1. Choose Container Settings.
  2. Choose Data Storage > Cloud Storage > Add Cloud Storage and set parameters by referring to Table 5.

    Table 5 SFS Turbo

    Parameter

    Description

    Type

    Select SFS Turbo.

    Standard and Infrequent Access OBS buckets are supported. OBS buckets apply to scenarios such as big data analytics, cloud native application data, static website hosting, and backup/active archiving.

    Allocation Mode

    Add Container Path

    1. Set Sub-path and Mount Path to the path to which the data storage is mounted.
      For example, if Mount Path is set to /tmp and Sub-path is set to /app, the data volume is mounted to /tmp/app of the application.
      NOTICE:
      • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
      • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.
    2. Set Permission.
      • Read-only: allows you only to read data volumes in the application path.
      • Read/Write: allows you to modify data volumes in the application path. To prevent data loss, newly written data will not be migrated during application migration.

  3. Click OK.

HostPath

The file or directory of the host is mounted to the component.

  1. Choose Container Settings.
  2. Choose Data Storage > Local Disk > Add Local Disk and set parameters by referring to Table 6.

    Table 6 HostPath

    Parameter

    Description

    Storage Type

    Select HostPath.

    Host Path

    Enter the host path, for example, /etc/hosts.

    Container Mounting

    1. Set Sub-path and Mount Path to the path to which the data storage is mounted.
      For example, if Mount Path is set to /tmp and Sub-path is set to /app, the data volume is mounted to /tmp/app of the application.
      NOTICE:
      • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
      • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.
    2. Set Permission.
      • Read-only: allows you only to read data volumes in the application path.
      • Read/Write: allows you to modify data volumes in the application path. To prevent data loss, newly written data will not be migrated during application migration.

  3. Click OK.

EmptyDir

EmptyDir applies to temporary data storage, disaster recovery, and shared running. It will be deleted upon deletion or transfer of application component instances.

  1. Choose Container Settings.
  2. Choose Data Storage > Local Disk > Add Local Disk and set parameters by referring to Table 7.

    Table 7 EmptyDir

    Parameter

    Description

    Storage Type

    Select EmptyDir.

    EmptyDir

    • If Memory is selected, the running speed is improved, but the storage capacity is limited by the memory size. This mode applies to a small amount of data with high requirements on reading and writing efficiency.
    • If Memory is not selected, data is stored in disks, which is applicable to a large amount of data with low requirements on reading and writing efficiency.

    Container Mounting

    1. Set Sub-path and Mount Path to the path to which the data storage is mounted.
      For example, if Mount Path is set to /tmp and Sub-path is set to /app, the data volume is mounted to /tmp/app of the application.
      NOTICE:
      • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
      • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.
    2. Set Permission.
      • Read-only: allows you only to read data volumes in the application path.
      • Read/Write: allows you to modify data volumes in the application path. To prevent data loss, newly written data will not be migrated during application migration.

  3. Click OK.

ConfigMap

ServiceStage separates the application codes from configuration files. ConfigMap is used to process application component configuration parameters.

  1. Choose Container Settings.
  2. Choose Data Storage > Local Disk > Add Local Disk and set parameters by referring to Table 8.

    Table 8 ConfigMap

    Parameter

    Description

    Storage Type

    Select ConfigMap.

    ConfigMap

    Select the desired configuration item name.

    For details about how to create a configuration item, see Creating a Configuration Item. The configuration item and the component instance container must be in the same namespace.

    Container Mounting

    Set Sub-path and Mount Path to the path to which the data storage is mounted.

    For example, if Mount Path is set to /tmp and Sub-path is set to /app, the data volume is mounted to /tmp/app of the application.

    When you select ConfigMap, only Read-only is supported. You can only read the data volume in the container path.
    NOTICE:
    • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
    • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.

  3. Click OK.

Secret

The data in the secret is mounted to the specified application component. The content of the secret is user-defined.

  1. Choose Container Settings.
  2. Choose Data Storage > Local Disk > Add Local Disk and set parameters by referring to Table 9.

    Table 9 Secret

    Parameter

    Description

    Storage Type

    Select Secret.

    Secret

    Select the desired secret name.

    For details about how to create a secret, see Creating a Secret. The secret and the component instance container must be in the same namespace.

    Container Mounting

    Set Sub-path and Mount Path to the path to which the data storage is mounted.

    For example, if Mount Path is set to /tmp and Sub-path is set to /app, the data volume is mounted to /tmp/app of the application.

    When you select Secret, only Read-only is supported. You can only read the data volume in the container path.
    NOTICE:
    • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
    • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.

  3. Click OK.