Typically, data is not persistently stored in a container. After a container is destroyed, data stored in the container is lost. In the rapidly developing Internet environment, data loss is a disaster in an online production environment. Kubernetes clusters in Enterprise Distributed Application Service (EDAS) support persistent volume claims (PVCs). This way, application instance data can be persistently stored and shared among instances. Multiple instances can read the data. This topic describes how to configure persistent storage.
Prerequisites
Configure persistent storage when you create an application
Log on to the EDAS 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.
In the Advanced Settings step, click Persistent Storage and configure the information about persistent storage.
Parameter
Description
PVC Mount
We recommend that you configure persistent storage by specifying PVC Mount. This method allows you to use Alibaba Cloud Elastic Block Storage (EBS), file storage systems, Object Storage Service (OSS), and local disks for storage when you create an application. The file storage systems include File Storage NAS (NAS) and Cloud Paralleled File System (CPFS). Before you specify PVC Mount, you need to create a persistent volume (PV) by referring to the corresponding steps in the topic of the storage service that you want to use. Then, you can mount the PVC on this page.
For more information about how to create a PVC, see NAS volume overview, OSS volume overview, and the overview of local storage volumes Overview.
NoteIf you have configured PVC Mount by using YAML files, the PVCs are not displayed in the Select PVC drop-down list. However, the PVC mount configurations are retained during application deployment. We recommend that you configure PVC Mount when you deploy applications in EDAS.
Select PVC
Select a PVC from the drop-down list. If no PVC is available, create a PVC. For more information, see Create a PVC.
Mount Configuration
Set the Mount Directory and Mount Mode parameters.
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 configure PVC Mount for persistent storage when you create an application, or configure or update the settings of PVC Mount when you deploy an application.
Log on to the EDAS 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 parameters for the application environment and deployment package, click Persistent Storage, complete the configuration as needed, and then click OK.
Parameter
Description
PVC Mount
We recommend that you configure persistent storage by specifying PVC Mount. This method allows you to use Alibaba Cloud Elastic Block Storage (EBS), file storage systems, Object Storage Service (OSS), and local disks for storage when you create an application. The file storage systems include File Storage NAS (NAS) and Cloud Paralleled File System (CPFS). Before you specify PVC Mount, you need to create a persistent volume (PV) by referring to the corresponding steps in the topic of the storage service that you want to use. Then, you can mount the PVC on this page.
For more information about how to create a PVC, see NAS volume overview, OSS volume overview, and the overview of local storage volumes Overview.
NoteIf you have configured PVC Mount by using YAML files, the PVCs are not displayed in the Select PVC drop-down list. However, the PVC mount configurations are retained during application deployment. We recommend that you configure PVC Mount when you deploy applications in EDAS.
Select PVC
Select a PVC from the drop-down list. If no PVC is available, create a PVC. For more information, see Create a PVC.
Mount Configuration
Set the Mount Directory and Mount Mode parameters.
ImportantThe application is restarted after you click OK. We recommend that you perform this operation during off-peak hours.
Remove persistent storage
If you no longer need persistent storage, you can redeploy the application to remove the settings of PVC Mount.
Log on to the EDAS 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 parameters for the application environment and deployment package, click Persistent Storage, unmount the PVC, and then click OK.
ImportantThe application is restarted after you click OK. We recommend that you perform this operation during off-peak hours.
After you unmount the PVC in the EDAS console, the data stored in the PVC is retained.
FAQ
How do I view the content in a PV?
To view the content in a PV, you must mount the PVC to an Elastic Compute Service (ECS) instance or a container. For more information, see Create a PVC.
Can the destination directory specified for log files be the same as that specified for a PVC?
No, the destination directory specified for log files cannot be the same as that specified for the PVC.
DingTalk group for ACK and Serverless Kubernetes clusters in EDAS
If you have questions or suggestions when you use Container Service for Kubernetes (ACK) and Serverless Kubernetes clusters in EDAS, submit a ticket. To give feedback, you can also join the DingTalk group by searching for the DingTalk group ID 23197114
.