In general, data is not persistently stored in a container. When a container is destroyed,
data stored in it is lost. In the rapidly developing Internet environment, data loss
is a disaster to an online production environment. Kubernetes clusters in Enterprise
Distributed Application Service (EDAS) support Apsara File Storage NAS (NAS) and persistent
volume claims (PVCs). This way, application instance data can be persistently stored
and shared among instances. Also, multiple instances can read the data.
Prerequisites
NAS is activated. When you use NAS, make sure that your current account has sufficient
balance or the billing method is subscription.
In the left-side navigation pane, click Applications. In the top navigation bar, select a region. In the upper part of the page, select
a namespace. In the upper-left corner of the Applications page, click Create Application.
In the Basic Information step, specify Cluster Type and Application Runtime Environment, and click Next.
Parameter
Description
Cluster Type
Select Kubernetes Clusters.
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 specify 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 specify 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 specify the Java Environment,
Pandora Version, and Ali-Tomcat Version parameters after you select this option.
PHP: Select this option if you want to run this application as a PHP application 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 microservice-based multi-language in Kubernetes clusters.
In the Configurations step, configure the environment information, basic information, deployment method,
and resource parameters for the application, and click Next.
In the Advanced Settings step, click Persistent Storage and configure persistent storage information.
Parameter
Description
Apsara File Storage NAS
Note When you use the NAS service, make sure that your clusters have the FlexVolume component
installed. For ASK clusters, make sure that the NAS mount directory exists. NAS is
billed based on actual usage. For more information, see NAS Pricing.
Storage Type
The default value is Apsara File Storage NAS, which cannot be changed.
Storage Service Type
The default value is SSD (Performance-type), which cannot be changed.
Select NAS
Buy New NAS: Select a NAS mount directory and a local mount directory. A single region supports
up to 10 NAS file systems. When this number in a single region exceeds 10, your attempt
to create more NAS file systems fails. To create more NAS file systems, submit a ticket.
Use Existing NAS: Select an existing NAS file system. You can create up to two mount targets. Only
the NAS file systems that meet the requirements appear in the drop-down list.
Mount Directory
Set the NAS Mount Directory and Mount Directory in Container parameters.
PVC Mount
Note PVC mounts that you configure by modifying YAML files are not displayed. These configurations
can be retained only during deployment. We recommend that you use EDAS to configure
PVC mounts when you deploy applications.
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.
In the Creation Completed step, confirm the settings in Basic Information, Configurations, and Advanced Settings, and 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 a few minutes until the application is
deployed. After the change process is complete, view the running status of the instances
in the Basic Information section of the Application Overview page. If the pod that runs the application is in the running state, the application
is deployed.
Configure persistent storage when you update an application
You can configure a NAS file system and PVC mounts for persistent storage when you
create an application, or configure or update the NAS file system and PVC mounts when
you deploy an application.
In the left-side navigation pane, click Applications. In the top navigation bar, select a region. On the Applications page, select a namespace
in the upper part, and 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 Application Overview or Basic Information page, choose Deploy > Deploy 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
Apsara File Storage NAS
Note When you use the NAS service, make sure that your clusters have the FlexVolume component
installed. For ASK clusters, make sure that the NAS mount directory exists. NAS is
billed based on actual usage. For more information, see NAS Pricing.
Storage Type
The default value is Apsara File Storage NAS, which cannot be changed.
Storage Service Type
The default value is SSD (Performance-type), which cannot be changed.
Select NAS
Buy New NAS: Select a NAS mount directory and a local mount directory. A single region supports
up to 10 NAS file systems. When this number in a single region exceeds 10, your attempt
to create more NAS file systems fails. To create more NAS file systems, submit a ticket.
Use Existing NAS: Select an existing NAS file system. You can create up to two mount targets. Only
the NAS file systems that meet the requirements appear in the drop-down list.
Mount Directory
Set the NAS Mount Directory and Mount Directory in Container parameters.
PVC Mount
Note PVC mounts that you configure by modifying YAML files are not displayed. These configurations
can be retained only during deployment. We recommend that you use EDAS to configure
PVC mounts when you deploy applications.
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.
Notice The application is restarted after you click OK. We recommend that you mount configurations during off-peak hours.
Verify the result
Linux, UNIX, and macOS
Method 1: Run the following command on an application instance to check whether the
application contains NAS mount information. We recommend that you use this method.
cat /proc/mount grep nfs
If the following information appears, the NAS file system is mounted.
Method 2: Use a Webshell to read and write files and check whether the NAS file system
is mounted.
Example:
Prepare application instances A and B and mount the NAS file system to the two application
instances. Run the write command echo "hello" > tmp.txt on Instance A and the read command cat tmp.txt on Instance B. If Instance B can read hello that is written to Instance A, the NAS file system is mounted.
Windows
Recommended. In the NAS console, check whether the instance IP address of the application
appears in the Client List dialog box of your mount target.
Notice In the Client List dialog box, only the IP addresses of the clients that use the NAS file system within
the last minute are displayed.
Click the created file system. On the page that appears, click Mount Targets in the
navigation tree. On the Mount Target page, find your mount target and click Client List in the Actions column.
In the Client List dialog box, check whether the instance IP address of the application appears. Then,
log on to the EDAS console and check the pod IP address of the application.
If the IP addresses are the same, the NAS file system is mounted.
In the EDAS console, view the change status on the change process details page. If
the change status is Succeeded, the application is deployed and the NAS file system is mounted.
Remove persistent storage
If you no longer need persistent storage, you can redeploy the application to remove
the NAS file system and PVC mounts.
In the left-side navigation pane, click Applications. In the top navigation bar, select a region. On the Applications page, select a namespace
in the upper part, and 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 Application Overview or Basic Information page, choose Deploy > Deploy 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 NAS file system, and then click OK.
Notice The application is restarted after you click OK. We recommend that you mount configurations during off-peak hours.
After you unmount the NAS file system in the EDAS console, the data stored in it is
retained.
Can the destination directory specified for log files be the same as that specified
for the NAS file system?
No, the destination directory specified for log files cannot be the same as that specified
for the NAS file system.
DingTalk group for Container Service for Kubernetes and Serverless Kubernetes clusters
in EDAS
If you have questions or suggestions when you use Container Service for Kubernetes
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.