Updated on 2023-06-27 GMT+08:00

Listing Clusters in a Specified Project

Function

This API is used to obtain details about all clusters in a specified project.

URI

GET /api/v3/projects/{project_id}/clusters

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the value, see How to Obtain Parameters in the API URI.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

detail

No

String

Whether the details about a cluster are queried.

If this parameter is set to true, the total number of nodes (totalNodesNumber), number of normal nodes (activeNodesNumber), total CPUs (totalNodesCPU), total memory size (totalNodesMemory), and installed add-ons (installedAddonInstances) will be added to the annotation. The details of installed add-ons include the add-on name (addonTemplateName), version (version), and status (status).

status

No

String

Cluster status. Possible values:

  • Available: The cluster is running properly.

  • Unavailable: The cluster is exhibiting unexpected behavior. Manually delete the cluster.

  • ScalingUp: Nodes are being added to the cluster.

  • ScalingDown: The cluster is being downsized to fewer nodes.

  • Creating: The cluster is being created.

  • Deleting: The cluster is being deleted.

  • Upgrading: The cluster is being upgraded.

  • Resizing: Cluster specifications are being changed.

  • RollingBack: The cluster is being rolled back.

  • RollbackFailed: The rollback is abnormal.

  • Empty: The cluster has no resources.

type

No

String

Cluster type. Options:

  • VirtualMachine: CCE cluster

  • ARM64: Kunpeng cluster

version

No

String

Cluster version filtering.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

X-Auth-Token

Yes

String

Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. For details, see Obtaining a User Token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

kind

String

Api type

apiVersion

String

API version

items

Array of Cluster objects

A list of details for all clusters in the current project. You can filter clusters by items.metadata.name.

Table 5 Cluster

Parameter

Type

Description

kind

String

API type. The value is fixed at Cluster or cluster and cannot be changed.

apiVersion

String

API version. The value is fixed at v3 and cannot be changed.

metadata

ClusterMetadata object

Basic information about a cluster. Metadata is a collection of attributes.

spec

ClusterSpec object

Detailed description of the cluster. CCE creates or updates objects by defining or updating spec.

status

ClusterStatus object

Cluster status and job ID of the cluster creation job.

Table 6 ClusterMetadata

Parameter

Type

Description

name

String

Cluster name.

Enter 4 to 128 characters, starting with a lowercase letter and not ending with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

uid

String

Cluster ID, which uniquely identifies a resource. The value is automatically generated after the object is created. A user-defined value will not take effect.

annotations

Map<String,String>

Cluster annotations, in the format of key-value pairs.

"annotations": {
   "key1" : "value1",
   "key2" : "value2"
}
NOTE:
  • annotations: Does not label or select objects. The metadata in annotations may be small or large, structured or unstructured, and may include characters that are not allowed in labels.

  • This field is not stored in the database and is used only to specify the add-ons to be installed in the cluster.

  • Install ICAgent during cluster creation by adding the key-value pair "cluster.install.addons.external/install":"[{"addonTemplateName":"icagent"}]".

labels

Map<String,String>

Cluster labels, in the format of key-value pairs.

NOTE:

The value of this field is automatically generated by the system and is used by the frontend to identify the features supported by the cluster during the upgrade. Customized values are invalid.

creationTimestamp

String

Time when the cluster was created.

updateTimestamp

String

Time when the cluster was updated.

Table 7 ClusterSpec

Parameter

Type

Description

category

String

Cluster type:

  • CCE: CCE cluster. CCE cluster supports hybrid deployment of VMs and bare-metal servers (BMSs), and heterogeneous nodes such as GPU- and NPU-enabled nodes. You can run your containers in a secure and stable container runtime environment based on a high-performance network model.

type

String

Master node architecture:

  • VirtualMachine: x86

flavor

String

Default value: When you create a CCE cluster, the value is cce.s1.small for non-DeC scenarios and cce.dec.s1.small for DeC scenarios.

Cluster flavor, which cannot be changed after the cluster is created.

  • cce.s1.small: small-scale, single-master CCE cluster (≤ 50 nodes)

  • cce.s1.medium: medium-scale, single-master CCE cluster (≤ 200 nodes)

  • cce.s2.small: small-scale, multi-master CCE cluster (≤ 50 nodes)

  • cce.s2.medium: medium-scale, multi-master CCE cluster (≤ 200 nodes)

  • cce.s2.large: large-scale, multi-master CCE cluster (≤ 1,000 nodes)

  • cce.s2.xlarge: ultra-large-scale, multi-master CCE cluster (≤ 2,000 nodes)

NOTE:
  • s1: single-master CCE cluster

  • s2: multi-master CCE cluster

  • dec: dedicated CCE cluster. For example, cce.dec.s1.small is a small-scale, single-master, dedicated CCE cluster (≤ 50 nodes).

  • Values in the parentheses above indicate the maximum number of nodes that can be managed by the cluster.

  • A single-master cluster has only one master node. If the master node is down, the cluster will become unavailable and stop serving new workloads. However, existing workloads in the cluster are not affected.

  • A multi-master cluster is highly available. When a master node is faulty, the cluster is still available.

version

String

Cluster version, which mirrors the baseline version of the Kubernetes community. The latest version is recommended.

You can create clusters of two latest versions on the CCE console. To learn which cluster versions are available, log in to the CCE console, create a cluster, and check the Version parameter. You can call APIs to create clusters of other versions. However, these clusters will be gradually brought offline. For details about the support policy, see the CCE announcement.

NOTE:
  • If not specified, a cluster of the latest version is created.

  • If the baseline cluster version is specified but the R version is not specified, the system selects the latest R version of the cluster by default. You are advised not to specify the R version.

platformVersion

String

CCE cluster platform version, indicating the internal version under the cluster version (version). Platform versions are used to trace iterations in a major cluster version. They are unique within a major cluster version and recounted when the major cluster version changes. This parameter cannot be customized. When you create a cluster, the latest corresponding platform version is automatically selected.

The format of platformVersion is cce.X.Y.

  • X: internal feature version, indicating changes in features, patches, or OS support in the cluster version. The value starts from 1 and increases monotonically.

  • Y: patch version of an internal feature version. It is used only for software package update after the feature version is brought online. No other modification is involved. The value starts from 0 and increases monotonically.

description

String

Cluster description, for example, which purpose the cluster is intended to serve. By default, this field is left unspecified. To modify cluster description after the cluster is created, call the API for updating cluster information or go to the cluster details page on the CCE console. Only UTF-8 encoding is supported.

customSan

Array of strings

Custom SAN field in the server certificate of the cluster API server, which must comply with the SSL and X509 format specifications.

  1. Duplicate names are not allowed.

  2. Must comply with the IP address and domain name formats.

Example:

SAN 1: DNS Name=example.com
SAN 2: DNS Name=www.example.com
SAN 3: DNS Name=example.net
SAN 4: IP Address=93.184.216.34

ipv6enable

Boolean

Whether the cluster supports IPv6 addresses. This field is supported in clusters of v1.15 and later versions.

hostNetwork

HostNetwork object

Node networking parameters, including VPC and subnet ID. This field is mandatory because nodes in a cluster communicate with each other by using a VPC.

containerNetwork

ContainerNetwork object

Container networking parameters, including the container network model and container CIDR block.

authentication

Authentication object

Configurations of the cluster authentication mode.

billingMode

Integer

Billing mode of a cluster.

  • 0: pay-per-use

Defaults to pay-per-use.

masters

Array of MasterSpec objects

Advanced configurations of master nodes

kubernetesSvcIpRange

String

Service CIDR block or the IP address range which kubernetes clusterIp must fall within. This field is available only for clusters of v1.11.7 and later.

clusterTags

Array of ResourceTag objects

Cluster resource tags.

kubeProxyMode

String

Service forwarding mode. Two modes are available:

  • iptables: Traditional kube-proxy uses iptables rules to implement Service load balancing. In this mode, too many iptables rules will be generated when many Services are deployed. In addition, non-incremental updates will cause latency and even tangible performance issues in the case of service traffic spikes.

  • ipvs: Optimized kube-proxy mode with higher throughput and faster speed. This mode supports incremental updates and can keep connections uninterrupted during Service updates. It is suitable for large-sized clusters.

az

String

AZ. This field is returned only for a query.

extendParam

ClusterExtendParam object

Extended field to decide whether the cluster will span across AZs or belong to a specified enterprise project, or whether a dedicated CCE cluster is to be created.

supportIstio

Boolean

Whether Istio is supported.

configurationsOverride

Array of PackageConfiguration objects

Whether to overwrite the default component configurations of the cluster. If a component or a parameter that is not supported by the component is specified, this configuration is ignored. For details about the supported configurable components and their parameters, see

Table 8 HostNetwork

Parameter

Type

Description

vpc

String

ID of the VPC used to create a master node

You can obtain it in either of the following ways:

  • Method 1: Log in to the VPC console and view the VPC ID in the VPC details.

  • Method 2: Query the VPC ID through the VPC API.

NOTE:

Currently, the VPC network model does not support interconnection with VPCs that contain a secondary CIDR block.

subnet

String

Network ID of the subnet used to create a master node. Methods:

  • Method 1: Log in to VPC console and click the target subnet on the Subnets tab page. You can view the network ID on the displayed page.

  • Method 2: Use the VPC API for querying subnets. . .

SecurityGroup

String

Default worker node security group ID of the cluster. If specified, the cluster will be bound to the target security group. Otherwise, the system will automatically create a default worker node security group for you. The default worker node security group needs to allow access from certain ports to ensure normal communications.

Table 9 ContainerNetwork

Parameter

Type

Description

mode

String

Container network model. Select one of the following possible values:

  • overlay_l2: an overlay_l2 network (container tunnel network) built for containers by using OpenVSwitch (OVS).

  • vpc-router: an underlay_l2 network built for containers by using IPVLAN and custom VPC routes.

cidr

String

Container CIDR block. Recommended: 10.0.0.0/12-19, 172.16.0.0/16-19, or 192.168.0.0/16-19. If the selected CIDR block conflicts with existing ones, an error will be reported.

Not editable after the cluster is created. (deprecated. A specified cidrs will make cidr invalid.)

cidrs

Array of ContainerCIDR objects

List of container CIDR blocks. In clusters of v1.21 and later, the cidrs field is used. When the cluster network type is vpc-router, you can add multiple container CIDR blocks. In versions earlier than v1.21, if the cidrs field is used, the first CIDR element in the array is used as the container CIDR block.

This parameter cannot be modified after the cluster is created.

Table 10 ContainerCIDR

Parameter

Type

Description

cidr

String

Container CIDR block. Recommended: 10.0.0.0/12-19, 172.16.0.0/16-19, and 192.168.0.0/16-19

Table 11 EniNetwork

Parameter

Type

Description

eniSubnetId

String

IPv4 subnet ID of ENI subnet. (IPv6 is not supported and is being discarded.) You can obtain it in either of the following ways:

  • Method 1: Log in to the VPC console and click the target subnet on the Subnets page. You can view the IPv4 subnet ID on the displayed page.

  • Method 2: Use the VPC API for querying subnets.

eniSubnetCIDR

String

ENI subnet CIDR (being discarded)

subnets

Array of NetworkSubnet objects

List of IPv4 subnet IDs

Table 12 NetworkSubnet

Parameter

Type

Description

subnetID

String

IPv4 subnet ID of the subnet for creating master nodes. Currently, IPv6 is not supported. You can obtain it in either of the following ways:

  • Method 1: Log in to the VPC console and click the target subnet on the Subnets page. You can view the IPv4 subnet ID on the displayed page.

  • Method 2: Use the VPC API for querying subnets.

Table 13 Authentication

Parameter

Type

Description

mode

String

Cluster authentication mode.

  • Clusters of Kubernetes v1.11 or earlier support x509, rbac, and authenticating_proxy. Defaults to x509.

  • Clusters of Kubernetes v1.13 or later support rbac and authenticating_proxy. Defaults to rbac.

authenticatingProxy

AuthenticatingProxy object

Configuration related to the authenticating_proxy mode. This field is mandatory when the authentication mode is authenticating_proxy.

Table 14 AuthenticatingProxy

Parameter

Type

Description

ca

String

X509 CA certificate (Base64-encoded) configured in authenticating_proxy mode. This field is mandatory when the cluster authentication mode is authenticating_proxy.

Maximum size: 1 MB

cert

String

Client certificate issued by the X509 CA certificate configured in authenticating_proxy mode, which is used for authentication from kube-apiserver to the extended API server. (The value must be Base64-encoded.) This field is mandatory when the cluster authentication mode is authenticating_proxy.

privateKey

String

Private key of the client certificate issued by the X509 CA certificate configured in authenticating_proxy mode, which is used for authentication from kube-apiserver to the extended API server. The private key used by the Kubernetes cluster does not support password encryption. Use an unencrypted private key. (The value must be Base64-encoded.) This field is mandatory when the cluster authentication mode is authenticating_proxy.

Table 15 MasterSpec

Parameter

Type

Description

availabilityZone

String

AZ

Table 16 ResourceTag

Parameter

Type

Description

key

String

Key.

  • Cannot be null. Max characters: 128.

  • Use letters, digits, and spaces in UTF-8 format.

  • Can contain the following special characters: _.:/=+-@.

  • Cannot start with _sys_.

value

String

Value.

  • Can be null but not the default. Max characters: 255.

  • Use letters, digits, and spaces in UTF-8 format.

  • Can contain the following special characters: _.:/=+-@.

Table 17 ClusterExtendParam

Parameter

Type

Description

clusterAZ

String

AZ of master nodes in the cluster.

  • multi_az: (Optional) The cluster will span across AZs. This field is configurable only for high-availability clusters.

  • AZ of the dedicated cloud computing pool: The cluster will be deployed in the AZ of Dedicated Cloud (DeC). This parameter is mandatory for dedicated CCE clusters.

dssMasterVolumes

String

Whether the system and data disks of a master node use dedicated distributed storage. If this parameter is omitted or left unspecified, EVS disks are used by default.

This parameter is mandatory for dedicated CCE clusters. It is in the following format:

<rootVol.dssPoolID>.<rootVol.volType>;<dataVol.dssPoolID>.<dataVol.volType>

Field description:

  • rootVol is the system disk. dataVol is the data disk.

  • dssPoolID indicates the ID of the DSS storage pool.

  • volType indicates the storage volume type of the DSS storage pool, such as SAS and SSD.

Example: c950ee97-587c-4f24-8a74-3367e3da570f.sas;6edbc2f4-1507-44f8-ac0d-eed1d2608d38.ssd

NOTE:

This field cannot be configured for non-dedicated CCE clusters.

enterpriseProjectId

String

ID of the enterprise project that a cluster belongs to.

NOTE:
  • An enterprise project can be configured only after the enterprise project function is enabled.

  • The enterprise project to which the cluster belongs must be the same as that to which other cloud service resources associated with the cluster belong.

kubeProxyMode

String

Service forwarding mode. Two modes are available:

  • iptables: Traditional kube-proxy uses iptables rules to implement Service load balancing. In this mode, too many iptables rules will be generated when many Services are deployed. In addition, non-incremental updates will cause latency and even tangible performance issues in the case of service traffic spikes.

  • ipvs: Optimized kube-proxy mode with higher throughput and faster speed. This mode supports incremental updates and can keep connections uninterrupted during Service updates. It is suitable for large-sized clusters.

NOTE:

This parameter has been deprecated. If this parameter and kubeProxyMode in ClusterSpec are specified at the same time, the latter is used.

clusterExternalIP

String

EIP of the master node

alpha.cce/fixPoolMask

String

Number of mask bits of the fixed IP address pool of the container network model. This field is supported only for the VPC network model (vpc-router).

This parameter determines the number of container IP addresses that can be allocated to a node. The maximum number of pods that can be created on a node is decided by this parameter and maxPods set during node creation. For details, see Maximum Number of Pods That Can Be Created on a Node.

For integer characters, the value ranges from 24 to 28.

decMasterFlavor

String

Specifications of the master node in the dedicated hybrid cluster.

dockerUmaskMode

String

Default UmaskMode configuration of Docker in a cluster. The value can be secure or normal. If this parameter is not specified, normal is used by default.

kubernetes.io/cpuManagerPolicy

String

Cluster CPU management policy. The value can be none or static. Defaults to none.

  • none: CPU cores will not be exclusively allocated to workload pods. Select this value if you want a large pool of shareable CPU cores.

  • static: CPU cores can be exclusively allocated to workload pods. Select this value if your workload is sensitive to latency in CPU cache and scheduling.

upgradefrom

String

Records of how the cluster is upgraded to the current version

Table 18 PackageConfiguration

Parameter

Type

Description

name

String

Component name.

configurations

Array of ConfigurationItem objects

Component configuration item.

Table 19 ConfigurationItem

Parameter

Type

Description

name

String

Component configuration item name.

value

Object

Component configuration item value.

Table 20 ClusterStatus

Parameter

Type

Description

phase

String

Cluster status. Possible values:

  • Available: The cluster is running properly.

  • Unavailable: The cluster is exhibiting unexpected behavior. Manually delete the cluster.

  • ScalingUp: Nodes are being added to the cluster.

  • ScalingDown: The cluster is being downsized to fewer nodes.

  • Creating: The cluster is being created.

  • Deleting: The cluster is being deleted.

  • Upgrading: The cluster is being upgraded.

  • Resizing: Cluster specifications are being changed.

  • RollingBack: The cluster is being rolled back.

  • RollbackFailed: The rollback is abnormal.

  • Empty: The cluster has no resources.

jobID

String

Job ID.

reason

String

Reason of cluster state change. This parameter is returned if the cluster is not in the Available state.

message

String

Detailed information about why the cluster changes to the current state. This parameter is returned if the cluster is not in the Available state.

endpoints

Array of ClusterEndpoints objects

Access address of kube-apiserver in the cluster.

deleteOption

Object

Whether to delete configurations. This parameter is contained only in the response to the deletion request.

deleteStatus

Object

Whether to delete the status information. This parameter is contained only in the response to the deletion request.

Table 21 ClusterEndpoints

Parameter

Type

Description

url

String

Access address of kube-apiserver in the cluster.

type

String

Type of the cluster access address.

  • Internal: address for internal network access

  • External: address for external network access

Example Requests

None

Example Responses

Status code: 200

The cluster list is successfully obtained.

{
  "kind" : "Cluster",
  "apiVersion" : "v3",
  "items" : [ {
    "kind" : "Cluster",
    "apiVersion" : "v3",
    "metadata" : {
      "name" : "mycluster",
      "uid" : "4d1ecb2c-229a-11e8-9c75-0255ac100ceb",
      "creationTimestamp" : "2018-08-02 03:48:58.968214406 +0000 UTC",
      "updateTimestamp" : "2018-08-02 04:05:29.386391813 +0000 UTC"
    },
    "spec" : {
      "type" : "VirtualMachine",
      "flavor" : "cce.s1.small",
      "version" : "v1.7.3-r13",
      "description" : "awesome cluster",
      "customSan" : [ "192.168.1.0", "example.com" ],
      "hostNetwork" : {
        "vpc" : "f0c12911-4fdb-4284-9230-7ffb0860826a",
        "subnet" : "ac274229-fd2e-4695-9f01-a0c1372b8006"
      },
      "containerNetwork" : {
        "mode" : "overlay_l2",
        "cidr" : "172.16.0.0/16"
      },
      "authentication" : {
        "mode" : "x509",
        "authenticatingProxy" : { }
      },
      "billingMode" : 0
    },
    "status" : {
      "phase" : "Available",
      "endpoints" : [ {
        "url" : "https://192.168.0.11:5443",
        "type" : "Internal"
      } ]
    }
  } ]
}

Status Codes

Status Code

Description

200

The cluster list is successfully obtained.

Error Codes

See Error Codes.