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.

Prerequisites

  • 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.

Background information

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.

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, click Applications.
  3. 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.
  4. In the Create Application step of the Basic Information wizard page, specify the basic information about the application and click Next.
    Basic application information - Kubernetes
    1. In the Cluster Type section, click Kubernetes Cluster.
    2. In the Application Runtime Environment section, select Java as Hosted Applications, and click Custom.
  5. In the Application Configuration step, configure the application environment, select the demo image, and then click Next.
    Application configuration - Kubernetes
    1. 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.

    2. 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.
    3. Select default from the K8s Namespace drop-down list.
    4. Enter a name for the application in the Application Name field.
    5. Optional:Enter a description for the application in the Application Description field.
    6. Select Image Type as Demo Image.
    7. 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.
    8. Set Total Pods to 1.
    9. In the Single Pod Resource Quota section, set CPU Cores to 1, and Memory (MB) to 2048.
  6. 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.
  7. 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.

  8. 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.

  1. In the Application Overview section of the page, click the icon next to SLB (Public Network):.
  2. In the SLB (Public Network) dialog box, set the parameters for an SLB instance and a listener, and click OK.
    Create an SLB instance
    1. 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.
    2. Click TCP | HTTP next to . Then, set the SLB port to 80 and the container port to 18082.
    3. 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 SLB instance IP:port number.
  3. 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.
  4. 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