Reading a Specified Cluster

Function

This API is used to obtain details about a specified cluster.

The URL for cluster management is in the format of https://Endpoint/uri. In the URL, uri indicates the resource path, that is, the path for API access.

URI

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

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

cluster_id

Yes

String

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

Table 2 Query parameters

Parameter

Mandatory

Type

Description

errorStatus

No

String

This field allows a cluster to be in the Error state if exceptions occur when the cluster is being deleted. If the value of errorStatus is null, the cluster stays in the Deleting state, but not Error.

Minimum: 0

Maximum: 10

detail

No

String

Whether the details about a cluster are queried. If this parameter is set to true, the API obtains the total number of nodes (totalNodesNumber), number of normal nodes (activeNodesNumber), total CPUs (totalNodesCPU), total memory (totalNodesMemory), and installed add-ons (installedAddonInstances), and adds them to annotations.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

Default: application/json

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 field is mandatory and must be set to a user token. For details about how to obtain a token, see Authentication.

Maximum: 16384

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

kind

String

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

Default: Cluster

apiVersion

String

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

Default: v3

metadata

ShowClusterMetadata object

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

spec

V3ClusterSpec object

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

status

ClusterStatus object

Cluster status.

Table 5 ShowClusterMetadata

Parameter

Type

Description

name

String

Cluster name.

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

Minimum: 1

Maximum: 128

uid

String

Unique resource ID, which is automatically generated after the resource is created. It cannot be specified.

annotations

Map<String,String>

Cluster annotation. This field is not necessarily related to annotations during creation. The queried cluster information is returned based on the query parameters and stored in this field.

If detail is set to true, the annotation contains the total number of nodes in the cluster (totalNodesNumber), number of normal nodes (activeNodesNumber), total CPUs (totalNodesCPU), total memory (totalNodesMemory), and names of the installed add-ons (installedAddonInstances).

creationTimestamp

String

Time when the cluster was created. The value is automatically generated after the cluster is created. A user-defined value will not take effect.

updateTimestamp

String

Time when the cluster was updated. The value is automatically generated after the cluster is created. A user-defined value will not take effect.

labels

String

Cluster labels in the format of key-value pairs.

The value is automatically generated by the system and used by the frontend to identify the features supported by the cluster during the upgrade. The value specified by the user is invalid and is not necessarily related to the labels set during cluster creation.

Table 6 V3ClusterSpec

Parameter

Type

Description

type

String

Cluster type. Options:

  • VirtualMachine: CCE cluster.

A CCE cluster manages a group of node resources based on Kubernetes. It can manage VMs, bare-metal machines, or a combination of both. Kubernetes automatically schedules containers onto available nodes. Before creating a containerized workload, you must have an available cluster.

  • ARM64: Kunpeng cluster.

Containers in a Kunpeng cluster can run on Kunpeng servers that use Arm architecture and Kunpeng processors. Kunpeng-accelerated cloud servers are easy to deploy and provide comparable scaling and scheduling performance as x86-based cloud servers.

Enumeration values:

  • VirtualMachine
  • ARM64

flavor

String

Default value: When you create a CCE cluster or Kunpeng 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)

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, choose Dashboard > Buy Cluster on the CCE console and check the Version parameter. You can call APIs to create clusters of other versions. However, those cluster versions will be gradually brought offline. For details about the support policy, see CCE announcements.

NOTE:
  • If this field is not set, a cluster of the latest version is created by default.
  • 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.

description

String

Cluster description, for example, which purpose the cluster is intended to serve. By default, this field is left unspecified. After a cluster is created, you can modify the cluster information by calling the API for updating a specified cluster. Alternatively, you can modify the cluster information in the Description column on the cluster details page. Only UTF-8 encoding is supported.

Minimum: 0

Maximum: 200

ipv6enable

Boolean

Whether the cluster supports IPv6 addresses. This field is supported in 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.

eniNetwork

EniNetwork object

Configuration of Cloud Native Network 2.0. Specify this field when creating a CCE Turbo cluster (in OBT).

authentication

Authentication object

Configurations of the cluster authentication mode.

billingMode

Integer

Billing mode of a cluster. Currently, only pay-per-use clusters can be created by calling this API. Value 0 indicates pay-per-use. If this field is left unspecified, the default value 0 is used.

Default: 0

masters

Array of MasterSpec objects

Advanced configuration 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.

NOTE:

This field is displayed only in the response. Set this field in extendParam when creating a cluster.

Enumeration values:

  • iptables
  • ipvs

az

String

AZ. This field is returned only for a query.

extendParam

Map<String,String>

Extended fields in the format of key-value pairs. If the cluster will span across AZs or belong to a specified enterprise project, or a dedicated CCE cluster is to be created, set extended fields as follows:

  • clusterAZ: 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 field is mandatory for dedicated CCE clusters. For example, set this field to cn-north-4a for CN North-Beijing4, AZ 1. For more information, see [What Is DCC] (https://support.huaweicloud.com/en-us/productdesc-dcc/en-us_topic_0016310838.html).
  • dssMasterVolumes: Whether the system and data disks of a master node use dedicated distributed storage. If this field is omitted or left unspecified, EVS disks are used by default. This field is mandatory for dedicated CCE clusters. The value is in the following format:
<rootVol.dssPoolID>.<rootVol.volType>;<dataVol.dssPoolID>.<dataVol.volType>

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 This field cannot be configured for non-dedicated CCE clusters.

  • enterpriseProjectId: If the cluster will belong to a specific enterprise project, set the key-value pair {"enterpriseProjectId":"xxx"}.
NOTE:
  • An enterprise project can be configured only after you have enabled the enterprise project service. For details, see Accessing the Enterprise Center.
  • The enterprise project to which the cluster belongs must be the same as the enterprise project to which other cloud service resources associated with the cluster belong.
  • kubeProxyMode: 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.
  • clusterExternalIP: EIP of the master node.
  • alpha.cce/fixPoolMask: 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. The value is an integer ranging from 24 to 28.
  • decMasterFlavor: flavor of the master nodes in the dedicated CCE cluster. Maximum length: 255 characters
  • dockerUmaskMode: 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: cluster CPU management policy. The value can be none or static. The default value is 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.

supportIstio

Boolean

Whether Istio is supported.

Table 7 HostNetwork

Parameter

Type

Description

vpc

String

ID of the VPC used to create a master node. You can obtain the value of this parameter from Creating a VPC.

You can obtain the value in either of the following ways:

  • Method 1: Log in to the VPC console, and click the name of a VPC to view the VPC ID on the displayed details page.

Method 2: Query the VPC ID through the VPC API. For details, see Querying VPCs.

NOTE:

Currently, the VPC container network model does not support interconnection with VPCs that contain an extended CIDR block.

NOTE:

If you are an enterprise user, ensure that the enterprise project ID of the VPC is the same as that selected during cluster creation. The enterprise project ID of the cluster is specified by enterpriseProjectId in the extendParam field. The default value is 0, indicating the default enterprise project.

Minimum: 0

Maximum: 64

subnet

String

Network ID of the subnet used to create a master node. Perform the following step to obtain the value:

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

Method 2: Query the ID through the VPC API. For details, see Querying Subnets.

Minimum: 0

Maximum: 64

SecurityGroup

String

Security group ID of the node. The value is generated when you create a security group, and any user-defined value is invalid.

Table 8 ContainerNetwork

Parameter

Type

Description

mode

String

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

  • overlay_l2: an overlay_l2 network built for containers by using Open vSwitch (OVS).
  • vpc-router: an underlay_l2 network built for containers by using IPVlan and custom VPC routes.
  • eni*: cloud native 2.0 network model. This model deeply integrates the native ENI capability of VPC, uses the VPC CIDR block to allocate container addresses, and supports passthrough between load balancers and containers to provide high performance. You can use this network model when creating a CCE Turbo cluster (in OBT).

Tunnel network: In this model, the container network is an overlay network on top of a VPC network based on the VXLAN technology. VXLAN encapsulates Ethernet packets as UDP packets for tunnel transmission. Though at some cost of performance, the encapsulation in networking enables higher interoperability and compatibility with advanced features (such as network policy-based isolation), meeting the requirements of most applications.

VPC network: Routing is implemented within a VPC network according to custom VPC routes. Each node is assigned a CIDR block of a fixed size. vpc-router networks are free of tunnel encapsulation overheads and provide better container network performance than tunnel networks. In addition, as routes to node IP addresses and the containers have been configured on vpc-router, containers can be directly accessed from outside the cluster.

Minimum: 0

Maximum: 64

Enumeration values:

  • overlay_l2
  • vpc-router
  • eni

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 CIDR blocks, the system automatically selects another CIDR block.

If the maximum number of pods on a node is 110, each of the recommended container CIDR blocks supports at least 582 nodes. This field cannot be modified after the cluster is created. Exercise caution when setting this field.

Minimum: 0

Maximum: 64

Table 9 EniNetwork

Parameter

Type

Description

eniSubnetId

String

IPv4 network ID of the subnet for creating master nodes. Currently, IPv6 is not supported. To obtain the value, perform the following operations: - Method 1: Log in to the VPC console, click the subnet under the VPC to go to the subnet details page, and search for the IPv4 network ID. - Method 2: Query the ID through the VPC API. For details, see Querying Subnets.

Minimum: 0

Maximum: 64

eniSubnetCIDR

String

ENI subnet CIDR block.

Table 10 Authentication

Parameter

Type

Description

mode

String

Cluster authentication mode.

  • kubernetes Clusters of v1.11 or earlier support x509, rbac, and authenticating_proxy. The default value is x509.
  • Clusters of Kubernetes v1.13 or later support rbac and authenticating_proxy. The default value is rbac.

authenticatingProxy

AuthenticatingProxy object

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

Table 11 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. The maximum size of the certificate is 1 MB.

Table 12 MasterSpec

Parameter

Type

Description

availabilityZone

String

AZ.

Table 13 ResourceTag

Parameter

Type

Description

key

String

Key.

  • The value can contain a maximum of 36 UTF-8 characters.
  • The following special characters are not supported: [=*<>\,|/]+
  • ASCII control characters (0–31) are not supported.

Minimum: 1

Maximum: 36

value

String

Value.

  • The value can contain a maximum of 43 UTF-8 characters.
  • The following special characters are not supported: [=*<>\,|/]+
  • ASCII control characters (0–31) are not supported.

Maximum: 43

Table 14 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 or contact the administrator to 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.
  • 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.

isLocked

Boolean

The CBC resource is locked.

lockScene

String

Scenario where the CBC resource is locked.

lockSource

String

Resource locking.

lockSourceId

String

ID of the locked resource.

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 15 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

Information about the specified cluster is successfully obtained.

{
  "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" : "this is a demo cluster",
    "hostNetwork" : {
      "vpc" : "4d1ecb2c-229a-11e8-9c75-0255ac100ceb",
      "subnet" : "4d1ecb2c-229a-11e8-9c75-0255ac100ceb"
    },
    "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

Information about the specified cluster is successfully obtained.

Error Codes

See Error Codes.