Expose microservices deployed in a Container Service for Kubernetes (ACK) cluster by creating HTTP APIs and routes in Cloud-native API Gateway.
Prerequisites
-
A container cluster is created. Create an ACK managed cluster.
-
A microservices demo is deployed in your ACK cluster.
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.
-
Create a Cloud-native API Gateway instance.
Create a Cloud-native API Gateway instance.
-
-
Create a service source.
In Cloud-native API Gateway, add a service source and select Container Service for Kubernetes (ACK) as the source type.
-
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.
-
-
Verify that the route works.
Step 1: Create a Cloud-native API Gateway instance
-
Log on to the Cloud-native API Gateway console. On first use, complete the authorization:
NoteWhen 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.
-
Click Authorize Now on the page. In the dialog box that appears, click OK to complete the authorization.
-
Click Experience Cloud-native API Gateway Now to enter the console.
-
-
In the navigation pane on the left, choose Instance. In the top menu bar, select a region, and then click Create Instance.
ImportantThe Cloud-native API Gateway instance and ACK cluster must be in the same region.
-
On the Cloud-native API Gateway purchase page, select your configuration and click Buy Now.

-
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.
NoteThe gateway instance takes 2 to 3 minutes to create.
-
Click Management Console to open the Instance page.
The gateway instance is ready when its Status changes to Running.

Step 2: Create an HTTP API
-
In the navigation pane on the left, go to the API page and click Create API.
-
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
-
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

-
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
A default environment is automatically created and associated with a gateway instance upon creation.
-
For Instance, select the instance you created in Step 1.

-
Scenario: From the Scenario list, select Single Service.
-
In the Backend Services section, select Associated Service from the Service Name drop-down list.

-
Create a service source and a service.
-
Set Source Type to ACK.
-
Click Add Source and select the cluster you created in the Prerequisites section.
-
From the Services, select the
httpbinservice and click OK.
-
In the Backend Services section, select the service you just created from the Service Name drop-down list.

-
-
Click Save and Publish.
Step 4: Debug the route
-
In the navigation pane on the left, go to the API page and click the name of your target API.
-
In the route list, find the target route
httpbin-demoand click Debug in the Actions column. -
Enter
versionas the request parameter and click Send. The service response is displayed as shown in the following figure.
Related documents
-
Manage multiple ACK clusters by using Cloud-native API Gateway
-
Troubleshoot issues: FAQ
