All Products
Search
Document Center

Container Service for Kubernetes:Use ASM Gateway in Knative

Last Updated:Dec 01, 2025

For traffic management in large-scale distributed systems and microservices applications, particularly those that use or plan to use Istio as their service mesh framework, we recommend that you use Alibaba Cloud Service Mesh (ASM) as the gateway for traffic distribution and routing of Knative services. ASM gateway is compatible with the open-source Istio specifications, with control plane components managed by Container Service for Kubernetes (ACK). Using ASM gateway simplifies service management, including traffic routing and splitting management between service calls, authentication and security for inter-service communication, and enhanced observability capabilities within the mesh.

Prerequisites

An ASM instance of version 1.21.6.84 or later is created. For more information, see Create an ASM instance.

When you create an ASM instance, in the Kubernetes Cluster area, add the created ACK managed cluster or ACK Serverless cluster to the ASM instance, and enable Allow data plane cluster KubeAPI to access Istio CR.

Step 1: Deploy the ASM gateway

You can either select the ASM (Istio) service gateway directly during the initial Knative deployment, or configure it by modifying the configuration file if Knative is already installed.

During Knative installation

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, find the cluster you want and click its name. In the left navigation pane, choose Applications > Knative.

  3. On the Knative page, under the Components tab, click Deploy Knative, then select ASM at the Gateway section, and click Deploy.

    After successful deployment, you can use the ASM in Knative.

After Knative installation

  1. Edit the config-network ConfigMap.

    kubectl -n knative-serving edit configmap config-network
  2. Change the value of the ingress.class field to istio.ingress.networking.knative.dev, then save the file and exit the editor to apply the changes..

    apiVersion: v1
    data:
      ...
      ingress.class: istio.ingress.networking.knative.dev # Use the ASM service gateway
      ...
    kind: ConfigMap
    metadata:
      name: config-network
      namespace: knative-serving

Step 2: Access the deployed Service through the ASM gateway

This step uses a Knative Service to complete service deployment through ASM.

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, find the cluster you want and click its name. In the left navigation pane, choose Applications > Knative.

  3. Under the Services tab on the Knative page, select Namespace as default, then click Create from Template. Copy and paste the following YAML example into the template, and click Create to create a Service named helloworld-go.

    Important

    Replace {REGION-ID} in the code below with the region ID of your cluster (e.g., cn-beijing) to ensure access and use of the image.

    apiVersion: serving.knative.dev/v1
    kind: Service
    metadata:
      name: helloworld-go
    spec:
      template:
        spec:
          containers:
          - image: registry.{REGION-ID}.aliyuncs.com/knative-sample/helloworld-go:73fbdd56 # Please replace {REGION-ID} with the region of your cluster.
            env:
            - name: TARGET
              value: "Knative"
  4. Under the Gateway column on the Services page, you can get the gateway address of the helloworld-go Service.

  5. Run the following command to access the helloworld-go Service:

    curl -H "Host: helloworld-go.default.example.com" http://39.XX.XX.XX # Please use the actual IP and domain name of your gateway.

    Expected output:

    Hello Knative!

    The output indicates that the Service access is successful.

(Optional) Step 3: View Service monitoring data

Knative provides out-of-the-box monitoring features. On the Knative page, click the Monitoring Dashboards tab to view the monitoring data of the helloworld-go Service. For more information about how to enable the Knative dashboard, see View the Knative dashboard through Alibaba Cloud Prometheus monitoring.

References