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 a specified Kubernetes environment. A Kubernetes environment refers to a Kubernetes cluster. This topic provides an example on how to deploy a microservices-based application in a Kubernetes environment.
- The EDAS service is activated. For more information, see Activate EDAS.
- You cannot create a Kubernetes cluster in EDAS. You must create a Kubernetes cluster
in Container Service for Kubernetes (ACK) and then add the cluster to EDAS. For more
information, see Manage clusters.
Note In this example, we recommend that you add a Kubernetes cluster to the default namespace of the region. If you want to isolate resources and services in EDAS, you can add the Kubernetes cluster that you created to a specified namespace based on your requirements.
- Create an application image.
- Kubernetes environment: refers to a Kubernetes cluster that is deployed in a specified region and namespace.
- Application demo: EDAS provides the demo image of a 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 a Container Service Kubernetes cluster and Use a JAR package or a WAR package to deploy an application in a serverless Kubernetes cluster.
This topic describes how to deploy a microservices-based application. A demo image is used as an example. For more information about demos, see alibabacloud-microservice-demo.
- For more information about how to implement features that are related to microservices-based applications, see Application development overview.
Deploy the demo image of a 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 a service provider. After you deploy the service provider, follow the steps 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 namespace that you want to manage and click Create Application.
- In the Create Application step of the Basic Information wizard page, specify the basic information about the application and click Next.
- In the Cluster Type section, click Kubernetes Cluster.
- In the Application Runtime Environment section, select Java as Hosted Applications, and click Custom.
- In the Application Configuration step, configure the application environment, select the demo image, and then click
- Select Namespace from the 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 do not create a 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 namespaces. For more information, see Manage microservice namespaces.
- Select the Kubernetes cluster that you created and added to EDAS from the Cluster drop-down list. If you cannot find a Kubernetes cluster from the drop-down list, this indicates that no Kubernetes cluster is added to EDAS. In this case, you must first create a Kubernetes cluster and add the cluster to EDAS. For more information, see Manage clusters.
- Select default from the K8s Namespace drop-down list.
- Enter a name for the application in the Application Name field.
- Optional:Enter a description for the application in the Application Description field.
- Select Image Type as Demo Image.
- In the Select Image section, select Image Repository Namespace as . Then, select 1.0 in the rightmost drop-down list of edas-demo-image. The demo image edas-demo-image/provider in the image repository namespace edas-demo-image and the image version number 1.0 are provided by EDAS. You are not allowed to change the settings.
- Set Total Pods to 1.
- In the Single Pod Resource Quota section, set CPU Cores to 1, and Memory (MB) to 2048.
- Select Namespace from the drop-down list.
- In the Advanced Settings step, click Create Application. In the Advanced Settings step, you can configure advanced settings based on your requirements. For more information, see the advanced settings section of the Advanced configurations topic.
- In the Creation Completed step, confirm Basic Information, Configurations, and Advanced Settings, and then click Create Application.
After the system starts to deploy the application, the message Basic Information is prompted at the top of the page. It requires about 2 minutes to deploy the application.
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 result
The service consumer can be a web service consumer. After the server-side application and the client-side application are deployed, you can access the web page of the client-side application to verify the result.
- In the Application Overview section of the page, click the icon next to SLB (Public Network):.
- In the SLB (Public Network) dialog box, set the parameters for an SLB instance and a listener, and click OK.
It requires about 30 seconds to add an Internet-facing SLB instance. After the Internet-facing SLB instance is added, the endpoint of the Internet-facing SLB instance appears next to SLB (Public Network) in the Access configuration section. The endpoint format is
- In the Select SLB drop-down list, select Create SLB. If you have already created an SLB instance, you can select the SLB instance from the drop-down list.
- Click TCP | HTTP next to . Then, set the SLB port to 80 and the container port to 18082.
- Click OK.
SLB instance IP:port number.
- In the Select SLB drop-down list, select Create SLB.
- Paste the endpoint of the Internet-facing SLB instance to the address of the web browser
and press Enter to access the SLB instance. You are directed to the web page of the client-side application.
- Enter a string into the Echo this string field, for example,
Hello EDAS. After you enter a string, click Click here to check whether a successful response is displayed at the bottom of the page.
The Data Return After Call section displays the procedure how the client-side application (service consumer) calls the server-side application (service provider). If the string that you entered is returned, this indicates that service call is successful and the microservices-based application is deployed.
2020-08-25T10:00:01.866Z : Consumer received. 2020-08-25T10:00:01.878Z : Provider received. Provider processed after sleep 1 second! Echo String: "Hello EDAS" 2020-08-25T10:00:02.878Z : Provider Return 2020-08-25T10:00:02.882Z : Consumer Return