KubeVela is a modern and out-of-the-box platform used to deliver and manage applications. You can use Alibaba Cloud Service Mesh (ASM) and KubeVela to implement progressive releases for applications. In progressive releases, applications can be updated in a gradual manner. This topic describes how to use ASM and KubeVela to implement a progressive release.

Prerequisites

Background information

KubeVela is a modern and out-of-the-box platform that makes it easier to deliver and manage applications across hybrid environments. In addition, KubeVela is highly extensible and allows you to deal with rapid business changes by updating applications with ease. The Open Application Model (OAM) of KubeVela is designed and implemented with extreme extensibility. OAM provides programmable delivery workflows and is application-oriented and independent of infrastructure. For more information, see Progressive Rollout with Istio. kubevala

Usage notes

Before you start, you must download and decompress the asm_kubevela package on your computer. All required files are stored in the asm_kubevela folder.

The asm_kubevela folder contains the following files: application.yaml, application_rollback.yaml, application_rollout-v2.yaml, canary-rollout-wf-def.yaml, rollback-wf-def.yaml, and traffic-trait-def.yaml. Where:
  • In Step 3, the canary-rollout-wf-def.yaml, rollback-wf-def.yaml, and traffic-trait-def.yaml files are used.
  • In Step 4, the application.yaml file is used.
  • In Step 5, the application_rollout-v2.yaml file is used.
  • In Step 6, the application_rollback.yaml file is used.

Step 1: Install KubeVela

  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, choose Marketplace > App Catalog.
  3. On the App Catalog page, search for ack-kubevela. Then, click ack-kubevela.
  4. On the details page, click Deploy in the upper-right corner. In the Deploy panel, select a cluster, set relevant parameters, and then click OK.

Step 2: Enable automatic sidecar injection

  1. Log on to the ASM console.
  2. In the left-side navigation pane, choose Service Mesh > Mesh Management.
  3. On the Mesh Management page, find the ASM instance that you want to configure. Click the name of the ASM instance or click Manage in the Actions column.
  4. On the details page of the ASM instance, choose ASM Instance > Global Namespace in the left-side navigation pane.
  5. On the Global Namespace page, find the default namespace and click Enable Automatic Sidecar Injection in the Automatic Sidecar Injection column.
  6. In the Submit message, click OK.

Step 3: Deploy the configuration files of KubeVela

To integrate the traffic management rules of KubeVela with those of ASM, deploy the configuration files of KubeVela.
Note Before you perform this operation, make sure that the Kubernetes API of clusters on the data plane is allowed to access Istio resources. Otherwise, an error is reported. For more information, see Use the Kubernetes API of clusters on the data plane to access Istio resources.

Navigate to the asm_kubevela folder in the command prompt window. Then, run the following commands to deploy the configuration files of KubeVela:

kubectl apply -f rollback-wf-def.yaml
kubectl apply -f canary-rollout-wf-def.yaml
kubectl apply -f traffic-trait-def.yaml

Step 4: Deploy an application and a gateway

  1. Navigate to the asm_kubevela folder in the command prompt window. Then, run the following command to deploy the Bookinfo application:
    kubectl apply -f application.yaml

    In the application.yaml file, the type parameter in the traits parameter of the reviews application is set to canary-traffic. This indicates that a progressive release is configured.

  2. Deploy a gateway and a virtual service in the ASM console.
    1. Log on to the ASM console.
    2. In the left-side navigation pane, choose Service Mesh > Mesh Management.
    3. On the Mesh Management page, find the ASM instance that you want to configure. Click the name of the ASM instance or click Manage in the Actions column.
    4. Deploy a gateway.
      1. On the details page of the ASM instance, choose Traffic Management > Gateway in the left-side navigation pane. On the Gateway page, click Create from YAML.
      2. On the Create page, select default from the Namespace drop-down list, copy the following content to the code editor, and then click Create.
        apiVersion: networking.istio.io/v1alpha3
        kind: Gateway
        metadata:
          name: bookinfo-gateway
        spec:
          selector:
            istio: ingressgateway # use istio default controller
          servers:
          - port:
              number: 80
              name: http
              protocol: HTTP
            hosts:
            - "*"
    5. Deploy a virtual service.
      1. On the details page of the ASM instance, choose Traffic Management > VirtualService in the left-side navigation pane. On the VirtualService page, click Create from YAML.
      2. On the Create page, select default from the Namespace drop-down list, copy the following content to the code editor, and then click Create.
        apiVersion: networking.istio.io/v1alpha3
        kind: VirtualService
        metadata:
          name: bookinfo
        spec:
          hosts:
          - "*"
          gateways:
          - bookinfo-gateway
          http:
          - match:
            - uri:
                exact: /productpage
            - uri:
                prefix: /static
            - uri:
                exact: /login
            - uri:
                exact: /logout
            - uri:
                prefix: /api/v1/products
            route:
            - destination:
                host: productpage
                port:
                  number: 9080
    6. Access the Bookinfo application.
      1. Log on to the ACK console.
      2. In the left-side navigation pane of the ACK console, click Clusters.
      3. On the Clusters page, find the cluster that you want to manage. Then, click the name of the cluster or click Details in the Actions column.
      4. On the cluster details page, choose Network > Services in the left-side navigation pane.
      5. In the upper part of the Services page, select istio-system from the Namespace drop-down list. Find istio-ingressgateway and view the external endpoint whose port number is 80 in the External Endpoint column. Then, enter IP address of the ingress gateway whose port number is 80/productpage in the address bar of your browser to access the Bookinfo application.
        Refresh the page multiple times. You can see that black stars are displayed on the page. Black

Step 5: Progressively release an application

  1. Navigate to the asm_kubevela folder in the command prompt window. Then, run the following command to update the reviews application and adjust the traffic routed to the application:
    kubectl apply -f application_rollout-v2.yaml
    • The application_rollout-v2.yaml file is used to update the reviews image from V2 to V3. In addition, the file specifies that two instances are updated one by one in two phases.

      ...
          - name: reviews
            type: webservice
            properties:
              image: docker.io/istio/examples-bookinfo-reviews-v3:1.16.2
              port: 9080
              volumes:
                - name: wlp-output
                  type: emptyDir
                  mountPath: /opt/ibm/wlp/output
                - name: tmp
                  type: emptyDir
                  mountPath: /tmp
      
      
            traits:
              - type: expose
                properties:
                  port:
                    - 9080
      
              - type: rollout
                properties:
                  targetSize: 2
                  rolloutBatches:
                    - replicas: 1
                    - replicas: 1
      
              - type: canary-traffic
                properties:
                  port: 9080
      ...
      • targetSize: the number of phases for updating instances.
      • rolloutBatches: the number of instances to be updated in each phase.
    • The application_rollout-v2.yaml file specifies the following workflows:
      1. The batchPartition parameter is set to 0. This specifies that only one of the two pods of the reviews application is updated. The traffic.weightedTargets parameter is set to specify that 10% of the traffic is routed to the new reviews application, whereas 90% of the traffic is routed to the earlier version.
      2. The type parameter is set to suspend. This specifies that the application release is suspended after the first workflow is complete.
      3. The batchPartition parameter is set to 1. This specifies that both pods of the reviews applications are updated to V3. The traffic.weightedTargets parameter is set to specify that all traffic is routed to the new reviews application.
      ...
        workflow:
          steps:
            - name: rollout-1st-batch
              type: canary-rollout
              properties:
                # just upgrade first batch of component
                batchPartition: 0
                traffic:
                  weightedTargets:
                    - revision: reviews-v1
                      weight: 90 # 90% shift to new version
                    - revision: reviews-v2
                      weight: 10 # 10% shift to new version
      
            # give user time to verify part of traffic shifting to newRevision
            - name: manual-approval
              type: suspend
      
            - name: rollout-rest
              type: canary-rollout
              properties:
                # upgrade all batches of component
                batchPartition: 1
                traffic:
                  weightedTargets:
                    - revision: reviews-v2
                      weight: 100 # 100% shift to new version
      ...
  2. Enter IP address of the ingress gateway whose port number is 80/productpage in the address bar of your browser to access the Bookinfo application.
    Refresh the page multiple times. You can see red stars for 10% of the times and black stars for 90% of the times. Black starsRed stars
  3. Run the following command to continue the application release to update all images of the reviews application to V3:
    vela workflow resume book-info
  4. Enter IP address of the ingress gateway whose port number is 80/productpage in the address bar of your browser to access the Bookinfo application.
    Refresh the page multiple times. The page displays only red stars. This indicates that the reviews application is updated to V3. Red stars

Step 6: (Optional) Roll back the application

If you find that the new application does not meet your expectations, you can stop the application release and roll back the application to the earlier version.

  1. Run the following command to roll back the application:
    kubectl apply -f  rollback.yaml
    In the rollback.yaml file, the type parameter is set to canary-rollback. The following operations are automatically performed:
    • Update the targetRevisionName parameter of the application to the earlier version. Roll back all instances of the new application to the earlier version and keep all earlier instances that are not updated.
    • Update the route parameter of the virtual service to route all traffic to the earlier version.
    • Update the subset parameter of the destination rule to the earlier version.
      ...
      workflow:
        steps:
          - name: rollback
            type: canary-rollback
  2. Enter IP address of the ingress gateway whose port number is 80/productpage in the address bar of your browser to access the Bookinfo application.

    Refresh the page multiple times. The page displays only black stars. This indicates that the reviews application is rolled back to V2.

    Black stars