All Products
Search
Document Center

Microservices Engine:Get started with Microservices Governance in 15 minutes (for Go applications)

Last Updated:Oct 28, 2024

This topic describes how to get started with the core capabilities of Microservices Governance by using Go applications.

Prerequisites

  • (Recommended) A Container Service for Kubernetes (ACK) Serverless cluster or an ACK managed cluster is created. For more information, see ACK Serverless quick start or Create an ACK managed cluster.

    Note
    • If you want to create an ACK managed cluster, you must make sure that the minimum configuration requirement (10 CPU cores and 20 GB of memory) is met. We recommend that the configuration of a single instance does not exceed 2 CPU cores and 4 GB of memory.

    • An elastic IP address (EIP) is used to expose the API server for access to CloudShell.

    • CoreDNS is required for Kubernetes service discovery.

    • The default local domain name cluster.local is used for the ACK cluster.

  • Microservices Governance Enterprise Edition of Microservices Engine (MSE) is activated.

    Note

    Microservices Governance for Go applications can be used only if you use Microservices Governance Enterprise Edition. You can use this feature free of charge during the public preview period.

  • ack-onepilot is installed in the ACK cluster and advanced service governance is enabled for the cluster. For more information, see Enable MSE Microservices Governance for Go microservice applications in an ACK cluster.

  • An MSE cloud-native gateway is created to serve as the traffic ingress of the ACK cluster. For more information about how to create a cloud-native gateway, see Create a cloud-native gateway.

Deploy a demo

Demo overview

Kubernetes service discovery is used in this demo. Applications are called in the following order: A -> B -> C. Applications A and C have a base version and a canary version. You can obtain the application code from the code repository.

Application name

Programming language and framework version

Call method

A

go 1.20

gin 1.8.1

HTTP

B

go 1.19

gin 1.8.0

HTTP

C

go 1.18

gin 1.9.0

/

image

Deployment method 1: Use an existing image

If image packaging and upload are not convenient for you, you can skip the manual compilation and image generation process. Instead, you can directly use an existing image for deployment. Create deployments in your ACK cluster by using the following YAML code:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mse-go-demo-a-base
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mse-go-demo-a
  template:
    metadata:
      labels:
        app: mse-go-demo-a
        msePilotAutoEnable: "on"
        mseNamespace: mse-go-demo
        msePilotCreateAppName: "mse-go-demo-a"
        aliyun.com/app-language: golang
    spec:
      containers:
        - name: mse-go-demo-a
          image: registry.cn-hangzhou.aliyuncs.com/mse-governance-demo/gin-server-a:1.0
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mse-go-demo-a-gray
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mse-go-demo-a
  template:
    metadata:
      labels:
        app: mse-go-demo-a
        alicloud.service.tag: gray
        msePilotAutoEnable: "on"
        mseNamespace: mse-go-demo
        msePilotCreateAppName: "mse-go-demo-a"
        aliyun.com/app-language: golang
    spec:
      containers:
        - name: mse-go-demo-a-base
          image: registry.cn-hangzhou.aliyuncs.com/mse-governance-demo/gin-server-a:1.0
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: mse-go-demo-a
spec:
  selector:
    app: mse-go-demo-a
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mse-go-demo-b
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mse-go-demo-b
  template:
    metadata:
      labels:
        app: mse-go-demo-b
        msePilotAutoEnable: "on"
        mseNamespace: mse-go-demo
        msePilotCreateAppName: "mse-go-demo-b"
        aliyun.com/app-language: golang
    spec:
      containers:
        - name: mse-go-demo-b
          image: registry.cn-hangzhou.aliyuncs.com/mse-governance-demo/gin-server-b:1.0
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: mse-go-demo-b
spec:
  selector:
    app: mse-go-demo-b
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mse-go-demo-c-base
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mse-go-demo-c
  template:
    metadata:
      labels:
        app: mse-go-demo-c
        msePilotAutoEnable: "on"
        mseNamespace: mse-go-demo
        msePilotCreateAppName: "mse-go-demo-c"
        aliyun.com/app-language: golang
    spec:
      containers:
        - name: mse-go-demo-c
          image: registry.cn-hangzhou.aliyuncs.com/mse-governance-demo/gin-server-c:1.0
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mse-go-demo-c-gray
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mse-go-demo-c
  template:
    metadata:
      labels:
        app: mse-go-demo-c
        alicloud.service.tag: gray
        msePilotAutoEnable: "on"
        mseNamespace: mse-go-demo
        msePilotCreateAppName: "mse-go-demo-c"
        aliyun.com/app-language: golang
    spec:
      containers:
        - name: mse-go-demo-c
          image: registry.cn-hangzhou.aliyuncs.com/mse-governance-demo/gin-server-c:1.0
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: mse-go-demo-c
spec:
  selector:
    app: mse-go-demo-c
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
  type: ClusterIP

If you need to construct a request to observe the traffic, you can use the following YAML deployment script to send the request at regular intervals. By default, the script directly initiates a call to Application A. You can configure the environment variable MSE_GATEWAY_DOMAIN for the pod to change the domain name. For example, you can configure this environment variable to send the request to your cloud-native gateway.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: request-sender
spec:
  replicas: 1
  selector:
    matchLabels:
      app: request-sender
  template:
    metadata:
      labels:
        app: request-sender
    spec:
      containers:
        - name: request-sender
          image: registry.cn-hangzhou.aliyuncs.com/mse-governance-demo/requestsender:1.0
          imagePullPolicy: Always
          ports:
            - containerPort: 8080

Deployment method 2: Use the Go agent to compile and package an image

You can use the Go agent for compilation in the demo repository. However, you must manually package and upload the desired image. Clone the demo service code to your on-premises machine, go to mse-go-quickstart-demo, and then switch to the directories of Applications A, B, and C. Then, perform the following steps:

  1. Compile the Go binary file.

    1. Run the wget command to download the compilation tool based on the region where the compilation environment and the compilation machine reside.

      Note

      If you can access Object Storage Service (OSS) over the Internet, you can directly use the public endpoint of the operating system and architecture in the China (Hangzhou) region to obtain the compilation tool.

      Operating system

      Public endpoint

      VPC endpoint

      Linux (AMD64)

      wget "http://arms-apm-{region-id}.oss-{region-id}.aliyuncs.com/instgo/instgo-linux-amd64" -O instgo
      wget "http://arms-apm-{region-id}.oss-{region-id}-internal.aliyuncs.com/instgo/instgo-linux-amd64" -O instgo

      Linux (ARM64)

      wget "http://arms-apm-{region-id}.oss-{region-id}.aliyuncs.com/instgo/instgo-linux-arm64" -O instgo
      wget "http://arms-apm-{region-id}.oss-{region-id}-internal.aliyuncs.com/instgo/instgo-linux-arm64" -O instgo

      macOS (Darwin, ARM64)

      wget "http://arms-apm-{region-id}.oss-{region-id}.aliyuncs.com/instgo/instgo-darwin-arm64" -O instgo
      wget "http://arms-apm-{region-id}.oss-{region-id}-internal.aliyuncs.com/instgo/instgo-darwin-arm64" -O instgo

      macOS (Darwin, ARM64)

      wget "http://arms-apm-{region-id}.oss-{region-id}.aliyuncs.com/instgo/instgo-darwin-amd64" -O instgo
      wget "http://arms-apm-{region-id}.oss-{region-id}-internal.aliyuncs.com/instgo/instgo-darwin-amd64" -O instgo

      Windows (AMD64)

      wget "http://arms-apm-{region-id}.oss-{region-id}.aliyuncs.com/instgo/instgo-windows-amd64.exe" -O instgo.exe
      wget "http://arms-apm-{region-id}.oss-{region-id}-internal.aliyuncs.com/instgo/instgo-windows-amd64.exe" -O instgo.exe

      Replace {region-id} in the preceding endpoints with the region ID of the region where your compilation environment resides. For more information about mappings between regions and region IDs, see Supported regions.

      Note

      You can download the compilation tool in the following regions. More regions will be supported in the future.

      • Regions in China: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), and China (Shenzhen)

      • Regions outside China: Singapore and US (Silicon Valley)

    2. Grant executable permissions on the compilation tool. If your operating system is Linux or macOS (Darwin), perform this step. If your operating system is Windows, skip this step.

      # Grant executable permissions on the compilation tool.
      chmod +x instgo
    3. In the directory where the main function of the Go project is located, use the compilation tool to compile the project. Replace the {licenseKey} parameter in the command with the actual license key. To obtain the license key, click View License Key in the upper-right corner of the Overview page of Microservice Governance in the MSE console.

      Note
      1. The license keys of different regions in the same Alibaba Cloud account are different. Before you view the license key, you must switch to the required region.

      2. If you need to test the compilation results or you cannot obtain the license key, add --dev to your code to enable Dev Mode. In this mode, you do not need to specify the license key. The compilation results in Dev Mode are degraded. Do not use Dev Mode in a production environment.

      3. If you want to add additional parameters to the command for subsequent compilation operations, use a delimiter (--) after the options and then add the parameters in the original format.

      4. The first time you compile the Go binary file, the agent is downloaded to the /opt directory by default. In Windows, the agent is downloaded to the C:\ProgramData directory by default. If you do not have permissions on the directory, you can use --cacheDirg flag to specify a cache directory or run the sudo -E command to compile the Go binary file. In Windows, only the administrator can run the compilation command.

      Linux/Darwin

      ./instgo build --mse --licenseKey="{licenseKey}" -- {arg1} {arg2} ...

      Windows

      .\instgo.exe build --mse --licenseKey="{licenseKey}" -- {arg1} {arg2} ...

      If you want to perform compilation operations that involve cross-compilation, such as the compilation of Linux executable binary files in macOS, you must declare the following built-in environment variables of the SDK for Go before you run the command for the complication of the binary file:

      ## Compile Linux executable programs in the macOS (Darwin) operating system.
      #amd
      CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./instgo build --mse --licenseKey="{licenseKey}"
      #arm
      CGO_ENABLED=0 GOOS=linux GOARCH=arm64 ./instgo build --mse --licenseKey="{licenseKey}"
      
      ## Compile the Windows executable program in the macOS (Darwin) operating system.
      CGO_ENABLED=0 GOOS=windows GOARCH=amd64 ./instgo build --mse --licenseKey="{licenseKey}"
      
      ## Compile macOS (Darwin) executable programs in the Linux operating system
      #amd
      CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 ./instgo build --mse --licenseKey="{licenseKey}"
      #arm
      CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 ./instgo build --mse --licenseKey="{licenseKey}"
      
      ## Compile the Windows executable program in the Linux operating system.
      CGO_ENABLED=0 GOOS=windows GOARCH=amd64 ./instgo build --mse --licenseKey="{licenseKey}"
      
      ## Compile Linux executable programs in the Windows operating system.
      #amd
      SET CGO_ENABLED=0
      SET GOOS=linux
      SET GOARCH=amd64
      .\instgo.exe build --mse --licenseKey="{licenseKey}"
      #arm
      SET CGO_ENABLED=0
      SET GOOS=linux
      SET GOARCH=arm64
      .\instgo.exe build --mse --licenseKey="{licenseKey}"
      
      ## Compile macOS (Darwin) executable programs in the Windows operating system.
      #amd
      SET CGO_ENABLED=0
      SET GOOS=darwin
      SET GOARCH=amd64
      .\instgo.exe build --mse --licenseKey="{licenseKey}"
      #arm
      SET CGO_ENABLED=0
      SET GOOS=darwin
      SET GOARCH=arm64
      .\instgo.exe build --mse --licenseKey="{licenseKey}"

      The following table describes the common Instgo commands.

      Command

      Required

      flag

      Parameter type

      Description

      build (compilation)

      Yes

      --mse

      -

      Enables the MSE Microservices Governance feature for the specified agent.

      Yes (not required for Dev Mode)

      --licenseKey, -l

      string

      Specifies the license key of MSE Microservices Governance.

      No

      --dev

      -

      Specifies Dev Mode as the development mode. In this mode, you can compile data to test functionality without the need to specify the license key.

      Important

      Some features are degraded. Do not use Dev Mode in a production environment.

      No

      --agentVersion

      string

      Specifies the version of the agent.

      No

      --agentPath

      string

      Specifies the on-premises path of the agent.

      No

      --cacheDir

      string

      Specifies the cache directory of the agent.

      No

      --regionId, -r

      string

      The ID of the region where the OSS bucket of the agent dependencies resides. Default value: cn-hangzhou.

      No

      --timeout, -t

      int

      The timeout period for downloading the dependencies of the agent. Unit: seconds. Default value: 180.

      No

      --verbose, -v

      -

      Specifies whether to print detailed compilation logs.

      No

      --vpc

      -

      Specifies whether to download the dependencies of the agent over a virtual private cloud (VPC).

      update (update)

      Yes

      --licenseKey, -l

      string

      Specifies the license key of MSE Microservices Governance.

      No

      --cacheDir

      string

      Specifies the cache directory of the agent.

      No

      --regionId, -r

      string

      The ID of the region where the OSS bucket of the agent dependencies resides. Default value: cn-hangzhou.

      No

      --timeout, -t

      int

      The timeout period for downloading the dependencies of the agent. Unit: seconds. Default value: 180.

      No

      --vpc

      Specifies whether to download the dependencies of the agent over a VPC.

      clean (cleanup)

      -

      -

      -

      You can manually clear the compilation residual and restore the code of the file that is modified by the agent.

      version (version)

      -

      -

      -

      -

  2. Create a Dockerfile and specify the operating system (OS) image URL of your server in the Dockerfile.

    A

    FROM {OS image URL of your server}
    WORKDIR /
    COPY mse-go-demo-a /mse-go-demo-a
    ENTRYPOINT ["/mse-go-demo-a"]

    B

    FROM {OS image URL of your server}
    WORKDIR /
    COPY mse-go-demo-b /mse-go-demo-b
    ENTRYPOINT ["/mse-go-demo-b"]

    C

    FROM {OS image URL of your server}
    WORKDIR /
    COPY mse-go-demo-c /mse-go-demo-c
    ENTRYPOINT ["/mse-go-demo-c"]
  3. Create an image and push the image to your image repository.

    A

    docker build -t mse-go-demo-a:1.0 .
    docker tag mse-go-demo-a:1.0 {Repository URL of your image}/mse-go-demo-a:1.0
    docker push {Repository URL of your image}/mse-go-demo-a:1.0

    B

    docker build -t mse-go-demo-b:1.0 .
    docker tag mse-go-demo-b:1.0 {Repository URL of your image}/mse-go-demo-b:1.0
    docker push {Repository URL of your image}/mse-go-demo-b:1.0

    C

    docker build -t mse-go-demo-c:1.0 .
    docker tag mse-go-demo-c:1.0 {Repository URL of your image}/mse-go-demo-c:1.0
    docker push {Repository URL of your image}/mse-go-demo-c:1.0
  4. In the left-side navigation pane of the cluster details page, choose Workloads > Deployments. On the page that appears, select the desired namespace, and click Create from YAML in the upper-right corner. Then, copy the YAML code of each application to the template.

    Note

    Set spec.template.spec.containers.image to the URL of the repository to which you pushed the image in Step 3.

    A

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: mse-go-demo-a-base
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: mse-go-demo-a
      template:
        metadata:
          labels:
            app: mse-go-demo-a
            msePilotAutoEnable: "on"
            mseNamespace: mse-go-demo
            msePilotCreateAppName: "mse-go-demo-a"
            aliyun.com/app-language: golang
        spec:
          containers:
            - name: mse-go-demo-a
              image: {Repository URL of your image}
              imagePullPolicy: Always
              ports:
                - containerPort: 8080
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: mse-go-demo-a-gray
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: mse-go-demo-a
      template:
        metadata:
          labels:
            app: mse-go-demo-a
            alicloud.service.tag: gray
            msePilotAutoEnable: "on"
            mseNamespace: mse-go-demo
            msePilotCreateAppName: "mse-go-demo-a"
            aliyun.com/app-language: golang
        spec:
          containers:
            - name: mse-go-demo-a-base
              image: {Repository URL of your image}
              imagePullPolicy: Always
              ports:
                - containerPort: 8080
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: mse-go-demo-a
    spec:
      selector:
        app: mse-go-demo-a
      ports:
        - protocol: TCP
          port: 80
          targetPort: 8080
      type: LoadBalancer

    B

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: mse-go-demo-b
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: mse-go-demo-b
      template:
        metadata:
          labels:
            app: mse-go-demo-b
            msePilotAutoEnable: "on"
            mseNamespace: mse-go-demo
            msePilotCreateAppName: "mse-go-demo-b"
            aliyun.com/app-language: golang
        spec:
          containers:
            - name: mse-go-demo-b
              image: {Repository URL of your image}
              imagePullPolicy: Always
              ports:
                - containerPort: 8080
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: mse-go-demo-b
    spec:
      selector:
        app: mse-go-demo-b
      ports:
        - protocol: TCP
          port: 80
          targetPort: 8080
      type: ClusterIP

    C

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: mse-go-demo-c-base
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: mse-go-demo-c
      template:
        metadata:
          labels:
            app: mse-go-demo-c
            msePilotAutoEnable: "on"
            mseNamespace: mse-go-demo
            msePilotCreateAppName: "mse-go-demo-c"
            aliyun.com/app-language: golang
        spec:
          containers:
            - name: mse-go-demo-c
              image: {Repository URL of your image}
              imagePullPolicy: Always
              ports:
                - containerPort: 8080
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: mse-go-demo-c-gray
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: mse-go-demo-c
      template:
        metadata:
          labels:
            app: mse-go-demo-c
            alicloud.service.tag: gray
            msePilotAutoEnable: "on"
            mseNamespace: mse-go-demo
            msePilotCreateAppName: "mse-go-demo-c"
            aliyun.com/app-language: golang
        spec:
          containers:
            - name: mse-go-demo-c-base
              image: {Repository URL of your image}
              imagePullPolicy: Always
              ports:
                - containerPort: 8080
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: mse-go-demo-c
    spec:
      selector:
        app: mse-go-demo-c
      ports:
        - protocol: TCP
          port: 80
          targetPort: 8080
      type: ClusterIP

    If you need to construct a request to observe the traffic, you can use the following YAML deployment script to send the request at regular intervals. By default, the script directly initiates a call to Application A. You can configure the environment variable MSE_GATEWAY_DOMAIN for the pod to change the domain name. For example, you can configure this environment variable to send the request to your cloud-native gateway.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: request-sender
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: request-sender
      template:
        metadata:
          labels:
            app: request-sender
        spec:
          containers:
            - name: request-sender
              image: registry.cn-hangzhou.aliyuncs.com/mse-governance-demo/requestsender:1.0
              imagePullPolicy: Always
              ports:
                - containerPort: 8080

Verify basic features

Note

Before you use throttling rules and end-to-end canary release, make sure that ack-onepilot 3.2.3 or later is installed and advanced service governance is enabled. You can perform the installation operation by following the instructions in Enable MSE Microservices Governance for Go microservice applications in an ACK cluster.

Service query

  1. Log on to the MSE console. In the left-side navigation pane, choose Microservices Governance > Service query. On the Service query page, select mse-go-demo from the microservice namespace drop-down list, and select Gin from the Framework drop-down list.

  2. Check whether the mse-go-demo-a, mse-go-demo-b, and mse-go-demo-c services are displayed in the list. If the services are displayed, Microservices Governance is enabled for demo applications.

Throttling rules

Create a route for a cloud-native gateway

  1. Log on to the MSE console. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. On the Gateways page, click the gateway in the same VPC as your ACK cluster.

  2. In the left-side navigation pane of the gateway details page, click Routes. On the page that appears, click the Source tab, and click Add Source. In the Add Source panel, select Container Service for Source Type, select your ACK cluster from the ACK/ACK Serverless Cluster drop-down list, and then click OK.

  3. In the left-side navigation pane of the gateway details page, click Routes. On the page that appears, click the Services tab, and click Add Service. In the Add Service panel, select Container Service from the Service Source drop-down list, select the namespace to which your demo applications belong from the Namespace drop-down list, add mse-go-demo-a to the Selected list in the Services section, and then click OK.

  4. In the left-side navigation pane of the gateway details page, click Routes. On the page that appears, click the Routes tab, and click Add Route. On the Add Route page, configure the following parameters, and click Save and Advertise.

    1. Routing Rule Name: Enter a random name.

    2. Domain name: Select * from the drop-down list.

    3. Path: Select Equal to from the drop-down list, and enter /greet1a in the field.

    4. Route Point: Select Single Service from the drop-down list.

    5. Backend Service

      1. Service Name: Select mse-go-demo-a.

      2. Service Protocol: Select HTTP.

      3. Service Port: Select 80.

    6. Timeout Period (s): Retain the default value 60.

Note

If you create a request sender in your demo, you can change the value of the environment variable MSE_GATEWAY_DOMAIN to the domain name of the cloud-native gateway for the associated pod. This way, the request script can directly access your cloud-native gateway instead of accessing Application A.

Add a rule

  1. Log on to the MSE console. In the left-side navigation pane, choose Microservices Governance > Application Governance. On the Application list page, select mse-go-demo from the namespace drop-down list.

  2. Click the mse-go-demo-a application card to go to the Application overview page. In the left-side navigation pane, click Traffic management. On the Traffic management page, click the Flow control tab, and click the Interface Flow Control subtab.

  3. Click Add Throttling Rule. In the Add Throttling Protection Rule dialog box, configure the following parameters, and click New.

    1. Select Protection Scenario

      1. API Type: Select WEB Service.

      2. Type of traffic: Select Server.

      3. Interface name: Select /greet1a.

      4. Protection Type: Select Flow Control.

    2. Configure Protection Rule

      1. Whether to open: Turn on the switch.

      2. Stand-alone QPS threshold: Enter 0. If you set this parameter to 0, risks may exist. This setting is used only for demonstration. We recommend that you do not use this setting in online scenarios.

      3. Flow control effect: Select Fast failure.

    3. Configure Protection Behavior: Select Default Behavior from the Association Behavior drop-down list.

Verify requests

  1. Log on to the MSE console. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. On the Gateways page, click the gateway in the same VPC as your ACK cluster.

  2. In the left-side navigation pane of the gateway details page, click Routes. On the page that appears, click the Routes tab. On the Routes tab, find the route that you configured in Step 1, and click Debug in the Actions column.

  3. Click Send. If the status code 429 is displayed in the right section, the throttling rule takes effect.

Disable a rule

  1. Log on to the MSE console. In the left-side navigation pane, choose Microservices Governance > Application Governance. On the Application list page, select mse-go-demo from the namespace drop-down list.

  2. Click the mse-go-demo-a application card to go to the Application overview page. In the left-side navigation pane, click Traffic management. On the Traffic management page, click the Flow control tab, and click the Interface Flow Control subtab.

  3. Find the rule that you configured, and turn off the switch in the Status column.

  4. Follow the instructions in "Verify requests" to initiate a request by using the cloud-native gateway. If the request is successful, the throttling rule is disabled.

End-to-end canary release

Create a lane group

  1. Log on to the MSE console. In the left-side navigation pane, choose Microservices Governance > Full link grayscale.

  2. Click Create Lane Group and Lane. If a lane group is available in the microservice namespace that you select, click + Create Lane Group.

  3. In the Create Lane Group panel, configure the following parameters and click OK.

    1. Lane Group Name: Enter a random name.

    2. Ingress Type: Select MSE Cloud-native Gateway.

    3. Ingress Gateway: Select the gateway that corresponds to the route that you created.

    4. Lane Group Application: Select mse-go-demo-a, mse-go-demo-b, and mse-go-demo-c.

Create a lane

  1. In the lower part of the Full link grayscale page, click Create First Split Lane. If a lane is available in the microservice namespace that you select, click Create Lane.

  2. In the Create Lane panel, configure the following parameters and click OK.

    1. Procedure: Select ACK.

    2. Lane Name: Enter gray.

    3. Lane Tag: Select gray.

    4. Select Route: Select the route that you created for the Go application on the cloud-native gateway.

    5. Canary Release Mode: Select Canary Release by Content.

    6. Canary Release Condition

      1. Parameter Type: Set this parameter to Header.

      2. Parameter: Enter x-mse-gray-test.

      3. Condition: Select ==.

      4. Value: Set this parameter to 1.

Verify requests

  1. Log on to the MSE console. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. On the Gateways page, click the gateway in the same VPC as your ACK cluster.

  2. In the left-side navigation pane of the gateway details page, click Routes. On the page that appears, click the Routes tab. On the Routes tab, find the route that you configured in Step 1, and click Debug in the Actions column.

  3. Click Send. The response body content shows that the request passed through the base nodes of the three applications.

  4. Click Add Parameter next to Header. Set KEY to x-mse-gray-test and VALUE to 1. Then, click Send. The response body content shows that the request passed through the canary nodes of Applications A and C.