All Products
Search
Document Center

Microservices Engine:Enable Microservices Governance for Java microservice applications in an ACK or ACS cluster

Last Updated:Nov 29, 2024

You can enable Microservices Governance of Microservices Engine (MSE) for microservice applications, such as Spring Cloud and Dubbo applications, that are deployed in a Container Service for Kubernetes cluster or Container Compute Service cluster. This way, you can use a series of service governance capabilities that are provided by MSE to govern the microservice applications. This helps improve the stability and development efficiency of online microservice applications. This topic describes how to enable Microservices Governance for microservice applications in an ACK or ACS cluster.

Prerequisites

Procedure

Note

We recommend that you comply with the following rules to enable Microservices Governance for applications:

  • If you need to enable Microservices Governance for all or most applications in a namespace, we recommend that you follow the instructions in "Scenario 1: Enable Microservices Governance for all applications in an ACK or ACS cluster namespace." For the other applications for which Microservices Governance does not need to be enabled in the namespace, add the flag spec.template.labels.msePilotAutoEnable: "off" for the applications.

  • If you need to enable Microservices Governance for a small number of applications in a namespace, we recommend that you follow the instructions in "Scenario 2: Enable Microservices Governance for a single application."

Scenario 1: Enable Microservices Governance for all applications in an ACK or ACS cluster namespace

After Microservices Governance is enabled for applications in a namespace, all the pods in the namespace are connected to Microservices Governance. You do not need to manually connect each pod to Microservices Governance.

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Governance > Application Governance.

  3. On the Application list page, click ACK Application Access.

  4. In the ACK Application Access dialog box, configure the parameters and click OK.

    image

    Parameter

    Description

    Cluster type

    Select ACK Cluster, ACK Serverless Cluster, or ACS Cluster.

    Note

    If you do not grant the cluster permissions to call MSE, you need to click the link to perform authorization.

    Cluster Name/ID

    Select the name or ID of the cluster for which Microservices Governance is enabled. You can use keywords to search for cluster names or IDs.

    ack-onepilot

    View the status of the ack-onepilot component.

    • If the ack-onepilot component is not installed, click Click Install on the right of ack-onepilot. After the installation is complete, the status of the ack-onepilot component is displayed as Installed.

    • If you perform the operation as a RAM user and a message is displayed, indicating that you have no permissions to perform the operation, you can log on to the ACK console to access the desired cluster, and choose Operations > Add-ons. Then, find ack-onepilot and click Install.

    Note
    • In this step, the ack-onepilot component is involved. You can log on to the ACK console to access the destination cluster, and choose Operations > Add-ons to view the component details.

    • After the ack-onepilot component is installed, the agent is automatically injected. In this case, the startup time of the application may be increased by up to 10s.

    Access Type

    Select Namespace Access.

    ACK Cluster Namespace

    Select an ACK cluster namespace.

    Microservices Governance Namespace

    Select the Microservices Governance namespace. Then, redeploy existing applications or create applications in the associated microservice namespace. This way, Microservices Governance is enabled for the applications.

Notes:

  • By default, the name of an application for which Microservices Governance is enabled is the name of the deployment. To modify the application name, you can edit the YAML file of the application.

    spec:
      template:
        metadata:
          labels:
            mseNamespace: default # The name of the MSE microservice namespace where your application resides. If you do not specify this parameter, the microservice namespace default is used. 
            msePilotCreateAppName: "your-deployment-name" # Replace your-deployment-name with the name of your application.

  • To disable Microservices Governance for an application, set msePilotAutoEnable to off for the application.

    spec:
      template:
        metadata:
          labels:
            msePilotAutoEnable: "off" # The off value must be enclosed in double quotation marks (") or single quotation marks (').

Scenario 2: Enable Microservices Governance for a single application

If Microservices Governance needs to be enabled only for a small number of applications in your namespace, you can separately enable MSE Microservices Governance for each of these applications.

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Governance > Application Governance.

  3. On the Application list page, click ACK Application Access.

  4. In the ACK Application Access dialog box, configure the parameters and click OK.

    image

    Parameter

    Description

    Cluster type

    Select ACK Cluster, ACK Serverless Cluster, or ACS Cluster.

    Note

    If you do not grant the cluster permissions to call MSE, you need to click the link to perform authorization.

    Cluster Name/ID

    Select the name or ID of the cluster for which Microservices Governance is enabled. You can use keywords to search for cluster names or IDs.

    ack-onepilot

    Displays the status of the ack-onepilot component.

    • If the ack-onepilot component is not installed, click Click Install on the right of ack-onepilot. After the installation is complete, the status of the ack-onepilot component is displayed as Installed.

    • If you perform the operation as a RAM user and a message is displayed, indicating that you have no permissions to perform the operation, you can log on to the ACK console to access the desired cluster, and choose Operations > Add-ons. Then, find ack-onepilot and click Install.

    Note
    • In this step, the ack-onepilot component is involved. You can log on to the ACK console to access the destination cluster, and choose Operations > Add-ons to view the component details.

    • After the ack-onepilot component is installed, the agent is automatically injected. In this case, the startup time of the application may be increased by up to 10s.

    Access Type

    Select Single Application Access.

    Access Procedure

    Perform the following steps:

    Step 1: Go to the ACK console, and click the cluster name. In the left-side navigation pane of the page that appears, choose Workloads > Deployments. Then, select the namespace to which the application belongs.

    Step 2: Click the name of the connected application. On the page that appears, click View in YAML.

    Step 3: Edit the labels field in the following format and click Update.

    spec:
      template:
        metadata:
          labels:
            # The on value indicates that Microservices Governance is enabled. The on value must be enclosed in double quotation marks (").
            msePilotAutoEnable: "on"
            # The MSE microservice namespace where your application resides. If the namespace that you specify does not exist, a namespace with the specified name is automatically created.
            mseNamespace: 202401
            # The actual name of the application for which Microservices Governance is enabled. The name must be enclosed in double quotation marks (").
            msePilotCreateAppName: "your-deployment-name"

Verify the result

After you perform the preceding steps and restart the applications, Microservices Governance is enabled for the applications that are deployed in the Container Service for Kubernetes or Container Compute Service cluster.

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Governance > Application Governance.

  3. Select a microservice namespace to view the applications for which Microservices Governance is enabled.