By default, data in a container is not persistent and is lost if the container is destroyed. Data loss can be disastrous in a production environment. Enterprise Distributed Application Service (EDAS) Kubernetes clusters support mounting persistent volume claims (PVCs). This feature provides data persistence for application instances and allows data to be shared with read access among multiple instances. This topic describes how to configure persistent storage.
Prerequisites
Configure persistent storage when you create an application
-
Log on to the EDAS consoleEDAS console.
-
In the left-side navigation pane, choose . In the top navigation bar, select a region. In the upper part of the Applications page, select a microservices namespace from the Microservices Namespace drop-down list. Then, click Create Application in the upper-left corner of the Applications page.
-
In the Basic Information step, specify Cluster Type and Application Runtime Environment and click Next. The following table describes the parameters.
Parameter
Description
Cluster Type
The type of the cluster in which you want to deploy the application. Select Kubernetes Clusters.
Application Runtime Environment
The 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.
-
-
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.
On the Application Advanced Settings tab, expand Persistent Deployment and configure persistent storage for data and logs.
Configuration item
Description
Mount PVC
Mounting a PVC is the recommended way to configure persistent storage. This method lets your application use Alibaba Cloud storage services such as Elastic Block Storage (EBS) disks, Apsara File Storage (NAS and CPFS), Object Storage Service (OSS), and local disks. Before you mount a PVC, create a persistent volume (PV) for the storage service that you want to use. Then, add the mount on the page.
For more information about how to create a PVC, see NAS volume overview, OSS volume overview, CPFS volume overview, and Local volume overview.
NoteIf you mount a PVC by modifying a YAML file, the existing PVC mount is not displayed when you deploy the application. The configuration is retained only during deployment. Mount the PVC when you deploy an application in EDAS.
Select PVC
Select a PVC from the drop-down list. If no PVCs are available, see Use a dynamic disk volume in the console.
Mount Configuration
Set Mount Directory and Mount Mode.
-
Click Create Application.
-
On the Creation Completed page, check the information in the Basic Information, Configurations, and Advanced Settings sections. Then, click Create Application.
In the upper part of the Application Overview page, click View Details. On the Change List page, view the application 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 persistent storage when you update an application
You can mount a PVC when you create an application. You can also configure or update a PVC mount when you deploy an existing application.
-
Log on to the EDAS consoleEDAS console.
-
In the left-side navigation pane, click . 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.
-
On the Overview or Basic information page, choose in the upper-right corner.
-
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.
Set the environment and deployment package information for the application. Then, expand Persistent Storage, configure the settings, and click OK.
Configuration item
Description
Mount PVC
Mounting a PVC is the recommended way to configure persistent storage. This method lets your application use Alibaba Cloud storage services such as Elastic Block Storage (EBS) disks, Apsara File Storage (NAS and CPFS), Object Storage Service (OSS), and local disks. Before you mount a PVC, create a persistent volume (PV) for the storage service that you want to use. Then, add the mount on the page.
For more information about how to create a PVC, see NAS volume overview, OSS volume overview, CPFS volume overview, and Local volume overview.
NoteIf you mount a PVC by modifying a YAML file, the existing PVC mount is not displayed when you deploy the application. The configuration is retained only during deployment. Mount the PVC when you deploy an application in EDAS.
Select PVC
Select a PVC from the drop-down list. If no PVCs are available, see Use a dynamic disk volume in the console.
Mount Configuration
Set Mount Directory and Mount Mode.
ImportantAfter you click OK, the application restarts. Perform this operation during off-peak hours.
Unmount persistent storage
If you no longer need persistent storage after mounting a PVC, you can unmount it by redeploying the application.
-
Log on to the EDAS consoleEDAS console.
-
In the left-side navigation pane, click . 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.
-
On the Overview or Basic information page, choose in the upper-right corner.
-
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.
Set the environment and deployment package information for the application. Then, expand Persistent Storage, unmount the PVC, and click OK.
ImportantAfter you click OK, the application restarts. Perform this operation during off-peak hours.
After you unmount the PVC in the EDAS console, the data stored in the PVC is not deleted.
FAQ
How can I view the contents of a PVC file system? Is there a user interface for this?
To view the content of a PVC file system, mount the file system to an ECS instance or a container. For more information, see Create a persistent volume claim.
Can the destination path specified for file logs be the same as the storage path specified for the PVC?
No, it cannot.
DingTalk group for ACK and Serverless Kubernetes clusters
If you have questions or suggestions about using Container Service for Kubernetes (ACK) and Serverless Kubernetes clusters in EDAS, you can join the DingTalk group by searching for the ID 23197114 in DingTalk.