APIG Ingress is built on the cloud-native API gateway and exposes Services inside a cluster to users.
For security reasons, APIG Ingress does not allow you to expose Services in the kube-system namespace.
Scope
You have completed Create an ACK managed cluster, and the cluster version is 1.18 or later.
You have completed Authorize the APIG controller.
Install APIG Controller
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click Components and Add-ons .
On the Add-ons page, enter
APIGin the search box. On the APIG Controller add-on card, click Install.In the Install Component APIG Controller dialog box, configure the parameter settings, and then click OK.
Create:
A pay-as-you-go cloud-native API gateway instance with the apig.small.x1 specification is automatically created.
ImportantWhen you select Create, the add-on creates a new ApigConfig resource and a cloud-native API gateway instance by default. The lifecycle of ApigConfig is bound to the cloud-native API gateway instance. Deleting the ApigConfig resource triggers a cascade delete of the cloud-native API gateway instance bound to it. Do not delete the ApigConfig resource arbitrarily.
If an IngressClass resource named apig already exists in the cluster, the ApigConfig resource and the cloud-native API gateway instance are not automatically created.
Select Existing VPC :
From the displayed list, select a pay-as-you-go cloud-native API gateway instance that resides in the same VPC as the container cluster and is not associated with another cluster. If the target instance does not appear in the selection list, check whether the instance is already associated with another cluster. An associated instance does not appear in the selectable list. In this case, select Create to create a new cloud-native API gateway instance.
If Failed to pass the precheck. occurs during the add-on installation, Authorize the APIG controller.
After the add-on is installed, you can see an ApigConfig resource named
apig-controller-pro-{clusterid}in the cluster. Log on to the cloud-native API gateway console. In the corresponding region, you can see a cloud-native gateway instance namedapig-controller-pro-{clusterid}.
Create a sample application
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
On the Deployments page, click Create from YAML. For example, use the following YAML sample to deploy a Deployment named
httpbinand a Service namedhttpbin.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 type: ClusterIPIn the pop-up message, click View and verify that the Pod status is
Running.
Configure APIG Ingress
On the Ingresses page, click Create Ingress.
In the Create Ingress dialog box, set Gateway Type to APIG Ingress, set Ingresses to Prefix Match, set Path to
/, forward requests to the Servicehttpbin, and then click OK.On the Ingresses page, view the endpoint information of the new Ingress in the Endpoint column. Use a browser, a CMD command, or another command line interface to access
Endpoint domain name/versionorGateway public IP/versionto test the Service. If the returned content isversion: v1, the Ingress is configured correctly.Log on to the cloud-native API gateway console. In the corresponding cloud-native API gateway instance, you can see an API whose name contains
{gwid}-ingress.
References
For more information about APIG Ingress and how it works, see APIG Ingress management.