doc-exports/docs/cce/api-ref/kubernetesapi.html
Dong, Qiu Jian 3336ba8df7 CCE API for v1.23
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
2022-11-10 12:48:59 +00:00

8.5 KiB

Overview

Description

You can use Kubernetes native APIs to manage your Kubernetes clusters. For details, see Kubernetes API Concepts.

To find detailed API definitions for different Kubernetes versions, visit the following links:

Based on the open source Kubernetes APIs, CCE enhances and adapts following functions.

Calling Kubernetes APIs Through API Gateway

You can call Kubernetes native APIs through API Gateway using the URL in the format of https://{clusterid}.Endpoint/uri. In the URL, {clusterid} indicates the cluster ID, and uri indicates the resource path, that is, the path for API access.

Table 1 URL parameters

Parameter

Description

{clusterid}

Cluster ID. After a cluster is created, call the API for obtaining a cluster in a specified project to obtain the cluster ID.

Endpoint

Web service entry URL. It can be obtained from Regions and Endpoints.

uri

Path in which the resource requested by the API is located. You can obtain the path from the URI of the API.

Calling Kubernetes APIs Through the API Server

You can use the API server of a Kubernetes cluster to call Kubernetes native APIs.

  1. Call the API for obtaining the cluster certificate to obtain the cluster certificates.

    There are three certificates:

    • ca.crt
    • client.crt
    • client.key

  2. Go to the cluster details page and obtain the API server address (private or public network address).

    With the certificates and API server address, you can call Kubernetes native APIs.

    For example, if you run the curl command to call the API to view the pod information, you only need to carry the certificate in the command as follows:

    curl --cert ./client.crt --key ./client.key https://192.168.0.198:5443/api/v1/namespaces/default/pods/