This topic describes how to deploy microservices-based applications in Enterprise Distributed Application Service (EDAS). EDAS provides microservices-based application demos that use the following frameworks: Spring Cloud, Dubbo, and High-speed Service Framework (HSF). You can deploy application demos to the specified Kubernetes clusters. This topic provides an example on how to deploy a microservices-based application in a Kubernetes cluster.
- EDAS is activated. For more information, see Activate EDAS.
- A Container Service for Kubernetes (ACK) cluster is created and added to EDAS. This
operation is required because you cannot create a Kubernetes cluster in EDAS. For
more information, see Manage clusters.
Note To experience the deployment practice, we recommend that you add a Kubernetes cluster to the default microservice namespace of the region that you use. If you want to isolate resources and services in EDAS, you can add the Kubernetes cluster that you created to a specified microservice namespace based on your requirements.
- An application image is created. For more information, see Create an application image.
- The RAM user that you use is authorized by the relevant Alibaba Cloud account to use the images in a repository of Container Registry Enterprise Edition to deploy applications. For more information, see Configure policies for RAM users to access Container Registry.
- Kubernetes cluster: In this practice, you must use a Kubernetes cluster that is deployed in a specified region and microservice namespace.
- Application demo: EDAS provides the demo image of a sample microservices-based application
in the EDAS console. The demo contains a server-side application (service provider)
and a client-side application (service consumer). You can use the demo to call simple
services. EDAS also provides WAR and JAR packages of microservices-based application
demos that use the Spring Cloud, Dubbo, and HSF frameworks. For more information about
how to deploy applications by using JAR or WAR packages, see Use a JAR or WAR package to deploy an application in an ACK cluster and Use a JAR or WAR package to deploy an application in a serverless Kubernetes cluster.
This topic describes how to deploy a microservices-based application. The demo image is used as an example. For more information about demos, see alibabacloud-microservice-demo.
- For information about how to implement features that are related to microservices-based applications, see Application development overview.
Deploy the demo image of a sample microservices-based application
The demo image of a microservices-based application contains a server-side application (service provider) and a client-side application (service consumer). This topic describes how to deploy the service provider. After you deploy the service provider, follow the instruction in this section to deploy the service consumer.
- Log on to the EDAS console.
- In the left-side navigation pane, click Applications.
- In the top navigation bar of the Applications page, select the region where you want to deploy the application. On the page that appears, select the microservice namespace that you want to manage and click Create Application.
- In the Basic Information step of the Create Application wizard, specify the basic information about the application and click Next.
- In the Cluster Type section, click Kubernetes Cluster.
- In the Application Runtime Environment section, set the Hosted Applications parameter to Java and click Custom.
- In the Configurations step, configure the application environment, select the required demo image, and
then click Next. Note Before you use the images in a repository of Container Registry Enterprise Edition to deploy applications as a RAM user, the RAM user must obtain the required permissions from the relevant Alibaba Cloud account. For more information, see Configure policies for RAM users to access Container Registry.
- Select Default from the Microservice Namespaces drop-down list.
This topic provides an example on how to deploy a microservices-based application demo in a Kubernetes cluster. We recommend that you use the default microservice namespace and do not create a microservice namespace when you deploy a microservices-based application demo in a Kubernetes cluster. If you want to isolate resources and services when you use EDAS, you can create a microservice namespace. For more information, see Manage microservice namespaces.
- Select the Kubernetes cluster where you want to deploy the application from the Cluster drop-down list. Note If the selected K8s cluster is not imported to EDAS, select This cluster is used for the first time in EDAS. If you select this check box, the cluster is imported to EDAS when an application is created. This consumes an amount of time. Then, check whether Alibaba Cloud Service Mesh is activated.
- Select default from the K8s Namespace drop-down list.
If you want to create a custom Kubernetes namespace, click Create Kubernetes Namespace. In the dialog box that appears, enter a name for the Kubernetes namespace in the K8s Namespace field. The name can contain digits, lowercase letters, and hyphens (-), and can be 1 to 63 characters in length. It must start and end with a letter or a digit.
- Enter a name for the application in the Application Name field.
- Optional:Enter a description for the application in the Application Description field.
- Set the Image Type parameter to Demo Image.
- In the Select Image section, set the Image Repository and Project parameters and select the uploaded demo.
- In the Select Image section, select edas-demo-image from the Image Repository Namespace drop-down list. Then, select 1.0 from the rightmost drop-down list of edas-demo-image/provider. The demo image edas-demo-image/provider in the image repository edas-demo-image and the image version number 1.0 are provided by EDAS. You are not allowed to change the settings.
- Set the Total Pods parameter to 1.
- In the Single-pod Resource Quota section, set the CPU Cores parameter to 1 and the Memory (MB) parameter to 2048.
- Select Default from the Microservice Namespaces drop-down list.
- In the Advanced Settings step, click Create Application. In the Advanced Settings step, you can configure the advanced settings based on your requirements. For more information, see Advanced settings.
- In the Creation Completed step, confirm the settings of Basic Information, Configurations, and Advanced Settings, and then click Create Application.
After the system starts to deploy the application, the message Application change in progress... is prompted in the upper part of the Basic Information page. The deployment requires about 2 minutes.
You can also click View Details next to the message to navigate to the Change Records page of the application. On this page, you can check the deployment progress and log data.
- Repeat the preceding steps to deploy the client-side application.
Verify the results
The service consumer can be a web service consumer. After the server-side application and the client-side application are deployed, you can go to the web page of the client-side application to verify the result.