All Products
Search
Document Center

API Gateway:Use Cloud-native API Gateway to expose ACK microservices

Last Updated:Jun 04, 2026

Expose microservices deployed in a Container Service for Kubernetes (ACK) cluster by creating HTTP APIs and routes in Cloud-native API Gateway.

Prerequisites

  1. A container cluster is created. Create an ACK managed cluster.

  2. A microservices demo is deployed in your ACK cluster.

    Deploy the microservices demo

    Log on to the Container Service for Kubernetes (ACK) console. In the navigation pane on the left, click Clusters.

    On the Clusters page, click the name of your cluster. In the navigation pane on the left, choose Workloads > Deployments.

    On the Deployments page, click Create from YAML. Deploy a deployment named httpbin and a service named httpbin.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: httpbin
      namespace: default
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: httpbin
      template:
        metadata:
          labels:
            app: httpbin
            version: v1
        spec:
          containers:
            - image: registry.cn-hangzhou.aliyuncs.com/mse-ingress/go-httpbin
              args:
                - "--version=v1"
              imagePullPolicy: Always
              name: httpbin
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: httpbin
      namespace: default
    spec:
      ports:
        - port: 8080
          protocol: TCP
      selector:
        app: httpbin

    On the Deployments page, click httpbin. The following status confirms successful deployment.

    image

Solution overview

Create a Cloud-native API Gateway instance, associate it with your container service, and define routing rules to forward requests to the target service.

  1. Create a Cloud-native API Gateway instance.

    Create a Cloud-native API Gateway instance.

  2. Create an HTTP API.

  3. Create a route.

    1. Create a service source.

      In Cloud-native API Gateway, add a service source and select Container Service for Kubernetes (ACK) as the source type.

    2. Add a service.

      Cloud-native API Gateway retrieves service namespaces from the specified ACK service source. Add an existing service to the gateway to use as a backend service.

  4. Debug the route.

    Verify that the route works.

Step 1: Create a Cloud-native API Gateway instance

  1. Log on to the Cloud-native API Gateway console. On first use, complete the authorization:

    Note

    When you access the Cloud-native API Gateway console for the first time, the system prompts you to authorize the creation of a service-linked role.

    1. Click Authorize Now on the page. In the dialog box that appears, click OK to complete the authorization.

    2. Click Experience Cloud-native API Gateway Now to enter the console.

  2. In the navigation pane on the left, choose Instance. In the top menu bar, select a region, and then click Create Instance.

    Important

    The Cloud-native API Gateway instance and ACK cluster must be in the same region.

  3. On the Cloud-native API Gateway purchase page, select your configuration and click Buy Now.

    image

  4. On the Confirm Order page, select the I have read and agree to the Cloud-native API Gateway (Pay-As-You-Go) Service Agreement checkbox, and click Activate Now.

    Note

    The gateway instance takes 2 to 3 minutes to create.

  5. Click Management Console to open the Instance page.

    The gateway instance is ready when its Status changes to Running.image

Step 2: Create an HTTP API

  1. In the navigation pane on the left, go to the API page and click Create API.

  2. On the HTTP API card, click Create. In the Create HTTP API panel, set the API Name and click Create.

Step 3: Create a route

  1. In the navigation pane on the left, go to the API page and click the name of your target API.

    Click Create Route. In the Create Route panel, configure the parameters.

Configure basic route information

image

  • Domain: Click Add Domain on the right to create a domain in the Add Domain panel.

  • Path: Matches requests with paths starting with /.

Instance and backend service

Note

A default environment is automatically created and associated with a gateway instance upon creation.

  1. For Instance, select the instance you created in Step 1.

    image

  2. Scenario: From the Scenario list, select Single Service.

  3. In the Backend Services section, select Associated Service from the Service Name drop-down list.image

  4. Create a service source and a service.

    1. Set Source Type to ACK.

    2. Click Add Source and select the cluster you created in the Prerequisites section.

    3. From the Services, select the httpbin service and click OK.

      image

    4. In the Backend Services section, select the service you just created from the Service Name drop-down list.

      image

  5. Click Save and Publish.

Step 4: Debug the route

  1. In the navigation pane on the left, go to the API page and click the name of your target API.

  2. In the route list, find the target route httpbin-demo and click Debug in the Actions column.

  3. Enter version as the request parameter and click Send. The service response is displayed as shown in the following figure.

    image

Related documents