Importing APIs Through CCE Workloads
You can import Cloud Container Engine (CCE) workloads to a gateway as backend services and open APIs in API Gateway for API callers.
Billing
For details, see CCE Billing.
Constraints
- Only Huawei Cloud CCE Turbo clusters and CCE clusters using the VPC network model are supported.
- The CCE cluster and your gateway must be in the same VPC or otherwise connected.
- If you select a CCE cluster that uses a VPC network model, add the container CIDR block of the cluster to Routes on the gateway details page.
- After the import, APIs will be generated, together with a microservice load balance channel that monitors and updates address changes of all pods in the workload.
- If your gateway does not support CCE workload import, contact customer service.
Prerequisites
You have created a CCE workload.
Importing a CCE Workload
- Go to the APIG console.
- Select a gateway at the top of the navigation pane.
- In the navigation pane, choose API Management > API Groups.
- Choose Create API Group > Import CCE Workload. Set the parameters according to the following table.
Table 1 Parameter description Parameter
Description
Group
API group to which the API generated for the imported workload will belong. You can create a group or select an existing group.
Cluster
Select the cluster where the workload is located. You can click View CCE Console to view the available clusters. Clusters are infrastructure resources provided by CCE. They are management units.
Namespace
Namespace to which the workload will belong. A namespace is an abstract collection of resources and objects.
Workload Type
A workload is an application running in a cluster. The following workload types are supported:
- Deployment: Deployments do not store any data or status while they are running.
- StatefulSet: StatefulSets store data and statuses while they are running.
- DaemonSet: DaemonSets ensure that only one pod runs on all or some nodes. When a node is added to a cluster, a new pod is also added for the node. When a node is removed from a cluster, the pod is also reclaimed. If a DaemonSet is deleted, all pods created by it will be deleted.
For details about workload types, see Overview.
Service Label Key
Pod label of a workload. The service label name is the pod label key and the service label value is the pod label value.
For details about pod labels, see Configuring Labels and Annotations.
Service Label Value
Tag
Pod label of a workload. If a workload cannot be identified by certain service label name and value, select another pod label to specify the workload.
Protocol
HTTP and HTTPS are supported. HTTPS is recommended for transmitting important or sensitive data.
Request Path
You can use a plus sign (+) to implement prefix matching. For example, if the request path is /a/{b+}, /a/ is a fixed prefix, and b and all the paths following b undergo matching.
Port
Listening port of the CCE workload. To obtain the port number, go to the Access Mode tab page of the workload details page and check the container port.
Authentication Mode
App and IAM authentication is supported. You can also choose not to authenticate requests.
- App: Requests will be authenticated by APIG. This authentication mode is recommended.
- IAM: Requests will be authenticated by IAM.
- None: No authentication will be required.
CORS
Determine whether to enable cross-origin resource sharing (CORS).
CORS allows browsers to send XMLHttpRequest to servers in other domains, overcoming the limitation that Asynchronous JavaScript and XML (AJAX) can be used only within the same domain.
There are two types of CORS requests:
- Simple requests: requests that have the Origin field in the header.
- Not-so-simple requests: HTTP requests sent before the actual request.
If CORS (not-so-simple request) is enabled for an API, another API that uses the OPTIONS method must be created. For details, see Enabling CORS.
Timeout (ms)
Backend request timeout. Range: 1–60,000 ms.
If a backend timeout error occurs during API debugging, increase the timeout to locate the reason.
NOTE:Modify the maximum timeout by referring to Configuring Gateway Parameters. The value range is 1 ms to 600,000 ms.
- Click OK.
If the corresponding API and load balance channel of the microservice type are generated after the import, the import is successful.
Related Documents
- After the API is imported and published, the API caller can call the API. For the API that needs App authentication, perform the operations described in (Optional) Configuring Authorization for API Calling before calling the API.
- You can also perform the operations described in Importing APIs through an API Design File or Importing APIs Through CSE Microservices.
- Selectively Exposing CCE Workloads with a Dedicated Gateway
- To import a CCE workload by calling an API, see Importing a Microservice.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot