Registering a Cluster
Function
This API is used to register a cluster. Third-party clusters and CCE clusters can be registered.
URI
POST /v1/clusters
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
No |
String |
Identity authentication information. 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. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
kind |
Yes |
String |
Resource type. For a registered cluster, set this parameter to Cluster. |
|
apiVersion |
Yes |
String |
API version. The current version is v1. |
|
metadata |
Yes |
metadata object |
Cluster metadata information |
|
spec |
Yes |
spec object |
Cluster specifications |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
uid |
No |
String |
Cluster ID |
|
name |
Yes |
String |
CCE cluster name or a custom cluster name (for other types of clusters). |
|
labels |
No |
Map<String,String> |
Label information. This parameter can be left empty. If it is not left empty, the value must comply with the Kubernetes label specifications. A maximum of 100 labels can be added. |
|
annotations |
No |
Map<String,String> |
Cluster annotations information. The kubeconfig field is mandatory for an attached cluster, and its value is the content of the kubeconfig file. For details about how to obtain the kubeconfig file, see Obtaining the kubeconfig File. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
clusterGroupID |
No |
String |
Container fleet ID |
|
category |
Yes |
String |
Cluster type. The value must meet the requirements for provider and type. For details, see Cluster Categories and Types. |
|
type |
Yes |
String |
Cluster type. The value must meet the requirements for provider and category. For details, see Cluster Categories and Types. |
|
provider |
Yes |
String |
Provider. The value must the requirements for category and type. For details, see Cluster Categories and Types. |
|
country |
Yes |
String |
Country code. For details, see Country Codes. |
|
city |
Yes |
String |
City code. For details, see City Codes. Only cities in China are supported. If it is a foreign city, you do not need to set this parameter. |
|
region |
No |
String |
Region information. This parameter is only used when a cluster is imported to CCE for registration. You can obtain the value from the region field in the API for querying CCE clusters that have not been registered with UCS. |
|
projectID |
No |
String |
Project ID. This parameter is only used when a cluster is imported to CCE for registration. You can obtain the value from the projectID field in the API for querying CCE clusters that have not been registered with UCS. |
|
manageType |
Yes |
String |
Cluster type. |
|
network |
No |
NetworkConfig object |
Network configuration of a multi-cloud cluster. You do not need to set this parameter for other types of clusters. |
Response Parameters
Status code: 201
|
Parameter |
Type |
Description |
|---|---|---|
|
uid |
String |
Cluster ID |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Status code: 409
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
- |
Example Requests
-
Registering a Huawei Cloud CCE cluster
POST https://ucs.myhuaweicloud.com/v1/clusters { "kind" : "Cluster", "apiVersion" : "v1", "metadata" : { "name" : "cce-cluster", "uid" : "44052cdd-8cd2-11ee-abd1-0255ac1001bd" }, "spec" : { "region" : "cn-north-4", "category" : "self", "type" : "turbo", "projectID" : "05495693df80d3c92fa1c01795c2be02", "clusterGroupID" : "", "manageType" : "discrete", "city" : "110000", "country" : "CN", "provider" : { "CCE" : "cce" } } } -
Registering an attached cluster
POST https://ucs.myhuaweicloud.com/v1/clusters { "kind" : "Cluster", "apiVersion" : "v1", "metadata" : { "name" : "ack-cluster", "annotations" : { "kubeconfig" : "{\"kind\":\"Config\",\"apiVersion\":\"v1\",\"preferences\":{},\"clusters\":[{\"name\":\"internalCluster\",\"cluster\":{\"server\":\"https://kubernetes.default.svc.cluster.local:443\",\"insecure-skip-tls-verify\":true}}],\"users\":[{\"name\":\"ucs-user\",\"user\":{\"token\":\"token-string\"}}],\"contexts\":[{\"name\":\"internal\",\"context\":{\"cluster\":\"internalCluster\",\"user\":\"ucs-user\"}}],\"current-context\":\"internal\"}" }, "labels" : { } }, "spec" : { "category" : "attachedcluster", "clusterGroupID" : "", "manageType" : "discrete", "city" : "110000", "country" : "CN", "provider" : { "ALI" : "aliyun", "TENCENT" : "tencentcloud", "AWS" : "aws", "GOOGLE" : "googlecloud", "AZURE" : "azure", "OPENSHIFT" : "openshift", "HUAWEISTACK" : "huaweicloudstack", "HUAWEI" : "huaweicloud", "PRIVATEK8S" : "privatek8s", "OTHER" : "other", "FLEXIBLEENGINE" : "FlexibleEngine", "FLEXIBLEENGINESTACK" : "FlexibleEngineStack", "OPENTELEKOMCLOUD" : "OpenTelekomCloud", "OPENTELEKOMCLOUDSTACK" : "OpenTelekomCloudStack", "TIANYI" : "ctcloud", "MOBILE" : "cmcloud" }, "type" : "ack" } }
Example Responses
Status code: 201
The cluster has been registered (the ID of the registered cluster is returned).
{
"uid" : "b0d1ecb5-7947-11ee-9467-0255ac1001bf"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
201 |
The cluster has been registered (the ID of the registered cluster is returned). |
|
400 |
Client request error. The server could not execute the request. |
|
403 |
The server refused the request. |
|
404 |
Resource not found. |
|
409 |
There was a request conflict. |
|
500 |
Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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