Updated on 2025-04-09 GMT+08:00

Method 2: Opening a CCE Workload by Importing It

  1. Import a CCE workload.

    1. Go to the APIG console, and choose Gateways in the navigation pane.
    2. Choose API Management > API Groups.
    3. Choose Create API Group > Import CCE Workload.
      1. Enter information about the CCE workload to import.
        Table 1 Workload information

        Parameter

        Description

        Group

        Group to which the CCE workload belongs. Default: New group.

        Cluster

        Select the created cluster.

        Namespace

        Select a namespace in the cluster. In this example, select default.

        Workload Type

        Select Deployment. This parameter must be the same as the type of the created workload.

        Service Label Key

        Select the pod label app and its value deployment-demo of the created workload.

        Service Label Value

        Tag

        Another pod label version=v1 of the workload is automatically selected.

      2. Configure API information.
        Table 2 API information

        Parameter

        Description

        Protocol

        API request protocol. HTTPS is selected by default.

        Request Path

        API request path for prefix match. Default: /. In this example, retain the default value.

        Port

        Enter 80. This must be the same as the container port in the workload.

        Authentication Mode

        Default: None. (None: Not recommended for actual services. All users will be granted access to the API.)

        CORS

        Disabled by default.

        Timeout (ms)

        Backend timeout. Default: 5000.

    4. Click OK. The CCE workload is imported, with an API group, API, and load balance channel generated.

  2. View the generated API and load balance channel.

    1. View the generated API.
      1. Click the API group name, and then view the API name, request method, and publishing status on the APIs tab.
      2. Click the Backend Configuration tab and view the bound load balance channel.
    2. View the generated load balance channel.
      1. Choose API Management > API Policies.
      2. On the Load Balance Channels tab, click the channel name to view details.
    3. Check that this load balance channel is the one bound to the API, and then go to the next step. If it is not, repeat 1.

  3. Open the API.

    Since importing a CCE workload already creates an API group and API, you only need to publish the API in an environment.
    1. Debug the API.

      On the APIs tab, click Debug. Click the Debug button in red background. If the status code 200 is returned in the response result, the debugging is successful. Then go to the next step. Otherwise, rectify the fault by following the instructions provided in Error Codes.

    2. Publish the API.

      On the APIs tab, click Publish Latest Version, retain the default option RELEASE, and click OK. When the exclamation mark in the upper left of the Publish button disappears, the publishing is successful. Then go to the next step.

  4. Call the API.

    1. Bind independent domain names to the group of this API.

      On the group details page, click the Group Information tab. The debugging domain name is only used for development and testing and can be accessed 1,000 times a day. Bind independent domain names to expose APIs in the group.

      Click Bind Independent Domain Name to bind registered public domain names. For details about how to bind a domain name, see Binding a Domain Name.

    2. Copy the URL of the API.

      On the APIs tab, copy the API URL. Open a browser and enter the URL. When the defined success response is displayed, the invocation is successful.

      Figure 1 Copying the URL

      Now, the CCE workload has been opened by importing it.