You can configure local storage to mount the files or directories in the file system of a host to a pod.

Background information

In a Container Service for Kubernetes (ACK) cluster of Enterprise Distributed Application Service (EDAS), you can configure local storage by using the hostPath volume that allows containers to store files by using the high-speed file system of the host.

Configure local storage when you create an application

  1. Log on to the EDAS console.
  2. Log on to the EDAS console. In the left-side navigation pane, click Application Management > Applications. In the top navigation bar, select a region. In the upper part of the page, select a namespace. On the Applications page, click Create Application in the upper-left corner.
  3. In the Basic Information step, specify Cluster Type and Application Runtime Environment and click Next. The following table describes the parameters.
    ParameterDescription
    Cluster TypeThe type of the cluster in which you want to deploy the application. Select Kubernetes Clusters.
    Application Runtime EnvironmentThe application runtime environment. Select an application runtime environment based on the type of the hosted application.
    • Java
      • Custom: Select this option if you want to use a custom image to deploy the application in a Kubernetes cluster.
      • Java: Select this option if you want to use a universal JAR package to deploy the application as a Dubbo or a Spring Boot application. You can set the Java Environment parameter after you select this option.
      • Tomcat: Select this option if you want to use a universal WAR package to deploy the application as a Dubbo or a Spring application. You can set the Java Environment and Container Version parameters after you select this option.
      • EDAS-Container (HSF): Select this option if you want to use a WAR or FatJar package to deploy the application as a High-speed Service Framework (HSF) application. You can set the Java Environment, Pandora Version, and Ali-Tomcat Version parameters after you select this option.
    • PHP: Select this option if the application is a PHP application that runs on Apache HTTP Server.
    • Node.js, C++, Go, and Other Languages: Select this option if you want to use a custom image to deploy the application in a Kubernetes cluster. The configuration process for multi-language applications is not described in this topic. For more information, see Use images to deploy multi-language microservices applications in Kubernetes clusters.
  4. In the Configurations step, configure the environment information, basic information, and deployment method for the application, set the related resource parameters, and then click Next.
  5. In the Advanced Settings step, click Local Storage and configure local storage as needed.

    Local storage supports Local File of Host and emptyDir.

    • Local File of Host
      File TypeValueDescription
      DefaultEmpty stringIndicates that the file is directly mounted without a file type check.
      (Create) File DirectoryDirectoryOrCreateThe file directory. If no file directory exists, a directory is created.
      File DirectoryDirectoryThe file directory. If no file directory exists, container startup fails.
      (Create) FileFileOrCreateThe file. If no file exists, a file is created.
      FileFileThe file. If no file exists, container startup fails.
      SocketSocketThe standard UNIX Socket file. If no file exists, container startup fails.
      CharDeviceCharDeviceThe character device file. If no file exists, container startup fails.
      BlockDeviceBlockDeviceThe block storage device file. If no file exists, container startup fails.
    • emptyDir

      Volumes of the emptyDir type are used for data sharing among temporary spaces or different containers.

      ParameterDescription
      Mount ModeThe mount mode. Valid values: Read/Write and Read-only.
      Mount PathThe mount path of emptyDir volumes.
      subPathExprThe field that is used to build the directory name of subPath volumes.
  6. Click Create Application.
  7. In the Creation Completed step, confirm the settings in the Basic Information, Configurations, and Advanced Settings sections, and then click Create Application.
    In the upper part of the Application Overview page, click View Details. On the Change List page, you can view the change process. Wait several minutes until the application is deployed. After the application change process is complete, view the status of the instance in the Basic Information section of the Application Overview page. If the status shows that a pod is running, the application is deployed.

Configure local storage when you update an application

You can configure local storage when you create an application, or configure or update local storage when you deploy an application.

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, click Application Management > Applications. In the top navigation bar, select a region. In the upper part of the page, select a namespace. Select Container Service or Serverless Kubernetes Cluster from the Cluster Type drop-down list. Then, find the application that you want to deploy and click the application name.
  3. On the Overview or Basic information page, choose Deploy > Deploy in the upper-right corner.
  4. On the Select Deployment Mode page, select a deployment mode and click Start Deployment in the upper-right corner of the specified deployment mode section.
  5. Set the environment and deployment package for an application, click Local Storage, complete the configuration as needed, and then click OK.

    Local storage supports Local File of Host and emptyDir.

    Important The application is restarted after you click OK. We recommend that you perform this operation during off-peak hours.
    • Local File of Host
      File TypeValueDescription
      DefaultEmpty stringIndicates that the file is directly mounted without a file type check.
      (Create) File DirectoryDirectoryOrCreateThe file directory. If no file directory exists, a directory is created.
      File DirectoryDirectoryThe file directory. If no file directory exists, container startup fails.
      (Create) FileFileOrCreateThe file. If no file exists, a file is created.
      FileFileThe file. If no file exists, container startup fails.
      SocketSocketThe standard UNIX Socket file. If no file exists, container startup fails.
      CharDeviceCharDeviceThe character device file. If no file exists, container startup fails.
      BlockDeviceBlockDeviceThe block storage device file. If no file exists, container startup fails.
    • emptyDir

      Volumes of the emptyDir type are used for data sharing among temporary spaces or different containers.

      ParameterDescription
      Mount ModeThe mount mode. Valid values: Read/Write and Read-only.
      Mount PathThe mount path of emptyDir volumes.
      subPathExprThe field that is used to build the directory name of subPath volumes.

Verify the result

  • Method 1

    In the left-side navigation pane of the application details page, click Change Records to view the change details of the application. If the value in the Change Status column is Success, the application is deployed and the configuration takes effect.

  • Method 2

    On the Application Overview page, click Running Pods (Click View) next to Running Status. In the Pod section of the App Configurations panel, check the Status column of the pod. If a green dot appears, the application is in the running state. This means that the application is deployed as expected and the configuration takes effect.