Cloud-native gateways are seamlessly integrated with the service discovery feature of Alibaba Cloud Container Service for Kubernetes (ACK). This allows you to easily publish applications deployed in an ACK cluster by using the cloud-native gateways. This way, you can efficiently and securely expose services. In this topic, an application that is deployed in an ACK cluster is used as an example to help you get started with cloud-native gateways.
Prerequisites
An ACK cluster is created. A
deployment
and a relatedservice
are deployed in the cluster. For more information about how to create an ACK cluster, see Create an ACK managed cluster.If no suitable deployment and service are available, you must deploy a
deployment
namedhttpbin
and aservice
namedhttpbin
based on the following YAML code. For more information about how to deploy a deployment and a service, see Create a stateless application by using a Deployment.
Procedure
You can perform the following steps to directly deploy applications in an ACK cluster by using a cloud-native gateway:
Create a cloud-native gateway.
Create a cloud-native gateway in the same region where your ACK cluster resides.
Create a routing policy and associate the routing policy with a service and a service source.
Debug the route by using the route debugging feature.
Step 1: Create a cloud-native gateway
If a cloud-native gateway is available in the region where your ACK cluster resides, skip this step.
Log on to the MSE console. In the top navigation bar, select a region.
In the upper-left corner of the Gateways page, click Create Gateway.
On the buy page, select the region where your ACK cluster resides and select the virtual private cloud (VPC) in which your ACK cluster is deployed. Set Network Type to Internet and click Buy Now.
NoteThe system may require 2 to 3 minutes to create the cloud-native gateway.
Step 2: Create a route
Log on to the MSE console. In the top navigation bar, select a region.
In the left-side navigation pane, choose Cloud-native Gateway > Gateways. On the Gateways page, click the name of the gateway.
In the left-side navigation pane, click the Routes tab. On the Routes tab, click Add Route.
On the Add Route page, configure the Routing Rule Name parameter. Select * from the Domain name drop-down list. In the Path section, select Prefix from the drop-down list and enter / in the field. Select Single Service for the Route Point parameter. Then, click Associate Service in the Service Name drop-down list.
In the Associate Service panel, set Source Type to Container Service, select the name of your ACK cluster for Service Source, select the applications in your ACK cluster that you want to expose in the service list, such as httpbin, and then click OK.
Select httpbin from the Service Name drop-down list. Click Save and Advertise.
When you create a route, you can create a domain name and associate the domain name with the route. For more information, see Create a domain name.
Cloud-native gateways are seamlessly integrated with container services and microservice systems, and support multiple service discovery methods, such as service discovery based on Kubernetes, MSE Nacos, or Enterprise Distributed Application Service (EDAS). For more information, see Add a service source.
Step 3: Debug the route
Log on to the MSE console. In the top navigation bar, select a region.
In the left-side navigation pane, choose Cloud-native Gateway > Gateways. On the Gateways page, click the name of the gateway.
In the left-side navigation pane, click Routes, and click the Routes tab.
On the Routes tab, click Debug in the Actions column of the
httpbin-demo
route.On the page that appears, enter
version
for the API parameter and click Send. The following figure shows the result that is returned.
References
For more information about the FAQ for cloud-native gateways, see FAQ about cloud-native gateways.
For more information about how to migrate services or traffic to a cloud-native gateway, see Migrate services from a Zuul gateway to a cloud-native gateway, Migrate services from a Spring Cloud Gateway to a cloud-native gateway, and Migrate traffic from an NGINX Ingress gateway to an MSE Ingress gateway.