Cluster Related Interface
Create Cluster
Description
Creates a CCE K8S cluster.
Request Structure
POST /v2/cluster HTTP/1.1
Host: cce.bj.baidubce.com
Authorization: authorization string
Request Header Fields
No other special header fields are available, except for common header fields.
Request Parameter
Parameter Name | Type | Required or not | Parameter Position | Description |
---|---|---|---|---|
Cluster | ClusterSpec | Yes | RequestBody parameter | The cluster configuration |
masters | List<InstanceSet> | No | RequestBody parameter | The cluster Master configuration, which supports the heterogeneous combination. When the cluster is a managed type, you do not need to set this parameter. |
nodes | List<InstanceSet> | No | RequestBody parameter | The cluster Worker configuration, which supports the heterogeneous combination. When you do not set this parameter, you should create a cluster that has a master node only. |
options | CreateClusterOptions | Yes | RequestBody parameter | The cluster creation option. The user can set it to skip the IP-address-range conflict check forcibly. |
Return Header Field
No other special header fields are available, except for common header fields.
Return Parameters
Parameter Name | Type | Required or not | Description |
---|---|---|---|
clusterID | String | Yes | The cluster ID |
requestID | String | Yes | The request ID, which is provided by the problem location. |
Request Example Hosting Master Cluster
- Set the
masterType
ofcluster.masterConfig
tomanaged
- No “masters” parameters need to be set.
- For other parameters, please see the API documentation to make settings as required
POST /v2/cluster HTTP/1.1
Host: cce.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
"cluster":{
"clusterName":"test-open-types",
"k8sVersion":"1.16.8",
"runtimeType":"docker",
"vpcID":"vpc-mwbgygrjb72w",
"masterConfig":{
"masterType":"managed",
"clusterHA":1,
"exposedPublic":false,
"clusterBLBVPCSubnetID":"sbn-mnbvhnuupv1u",
"managedClusterMasterOption":{
"masterVPCSubnetZone":"zoneA"
}
},
"containerNetworkConfig": {
"mode": "kubenet",
"lbServiceVPCSubnetID": "sbn-mnbvhnuupv1u",
"clusterPodCIDR": "172.28.0.0/16",
"clusterIPServiceCIDR": "172.31.0.0/16"
},
"k8sCustomConfig": {
"kubeAPIQPS": 1000,
"kubeAPIBurst": 2000
}
},
"nodes":[
{
"instanceSpec":{
"instanceName":"instance-name",
"clusterRole":"node",
"existed":false,
"machineType":"BCC",
"instanceType":"N3",
"vpcConfig":{
"vpcID":"vpc-mwbgygrjb72w",
"vpcSubnetID":"sbn-mnbvhnuupv1u",
"availableZone":"zoneA",
"securityGroup": {
"customSecurityGroups": [],
"enableCCERequiredSecurityGroup": true,
"enableCCEOptionalSecurityGroup": true
}
},
"instanceResource":{
"cpu":4,
"mem":8,
"rootDiskSize":40,
"localDiskSize":0,
"cdsList":[]
},
"imageID":"m-gTpZ1k6n",
"instanceOS":{
"imageType":"System",
"osType":"linux",
"osName":"CentOS",
"osVersion":"7.5",
"osArch":"x86_64 (64bit)"
},
"needEIP":false,
"adminPassword":"test123!T",
"instanceChargingType":"Postpaid",
"runtimeType":"docker"
},
"count":1
}
]
}
Request Examples Custom Master cluster
- Set the
masterType
ofcluster.masterConfig
tocustom
- Set the
masters
parameter - For other parameters, please see the API documentation to make settings as required
{
"cluster":{
"clusterName":"create-custom-cluster-reg",
"description":"Cluster description",
"k8sVersion":"1.16.8",
"runtimeType":"docker",
"vpcID":"vpc-43zsdm46t9rp",
"masterConfig":{
"masterType":"custom",
"exposedPublic":true,
"clusterBLBVPCSubnetID":"sbn-vvqsb9b57f24"
},
"containerNetworkConfig":{
"mode":"kubenet",
"lbServiceVPCSubnetID":"sbn-vvqsb9b57f24",
"nodePortRangeMin":50000,
"nodePortRangeMax":51000,
"clusterPodCIDR":"10.2.0.0/16",
"clusterIPServiceCIDR":"172.16.0.0/16",
"maxPodsPerNode":64,
"kubeProxyMode":"ipvs"
}
},
"masters":[
{
"instanceSpec":{
"machineType":"BCC",
"instanceType":"N3",
"vpcConfig":{
"vpcSubnetID":"sbn-vvqsb9b57f24",
"securityGroup": {
"customSecurityGroups": [],
"enableCCERequiredSecurityGroup": true,
"enableCCEOptionalSecurityGroup": true
}
},
"instanceResource":{
"CPU":4,
"MEM":8
},
"instanceOS": {
"imageName": "7.5 x86_64 (64bit)",
"imageType": "System",
"osType": "linux",
"osName": "CentOS",
"osVersion": "7.5",
"osArch": "x86_64 (64bit)"
},
"adminPassword":"test123!T"
},
"count":1
}
],
"nodes":[
{
"instanceSpec":{
"machineType":"BCC",
"instanceType":"N3",
"vpcConfig":{
"vpcSubnetID":"sbn-vvqsb9b57f24",
"securityGroupID":"g-k4tsm0id2g1n"
},
"instanceResource":{
"CPU":4,
"MEM":8,
"cdsList":[
{
"diskPath":"/data",
"storageType":"cloud_hp1",
"cdsSize":200
}
]
},
"instanceOS": {
"imageName": "7.5 x86_64 (64bit)",
"imageType": "System",
"osType": "linux",
"osName": "CentOS",
"osVersion": "7.5",
"osArch": "x86_64 (64bit)"
},
"adminPassword":"test123!T"
},
"count":1
}
]
}
Request Example Existing Instances
- If the Master needs to use an existing instance, set the
masterType
ofcluster.masterConfig
tocustom
- When adding a Master or Node machine configuration, set
instanceSpec.existed
to true andinstanceSpec.existedOption.existedInstanceID
to the existing node ID that you want to use - If you do not want to reinstall the system, set
instanceSpec.existedOption.rebuild
tofalse
and ensure that the machine password is correct. Otherwise, the node fails to create due to the inability to deploy related services - If you do not want to reinstall the system, you do not need to set
instanceSpec.instanceOS
andinstanceSpec.machineType
- For other parameters, see the API documentation to make settings as required
{
"cluster":{
"clusterName":"create-existed-bcc-cluster-reg",
"description":"Cluste description",
"k8sVersion":"1.16.8",
"runtimeType":"docker",
"vpcID":"vpc-43zsdm46t9rp",
"masterConfig":{
"masterType":"custom",
"exposedPublic":true,
"clusterBLBVPCSubnetID":"sbn-vvqsb9b57f24"
},
"containerNetworkConfig":{
"mode":"kubenet",
"lbServiceVPCSubnetID":"sbn-vvqsb9b57f24",
"nodePortRangeMin":30000,
"nodePortRangeMax":32768,
"clusterPodCIDR":"10.0.0.0/16",
"clusterIPServiceCIDR":"172.16.0.0/16",
"maxPodsPerNode":256,
"kubeProxyMode":"ipvs"
}
},
"masters":[
{
"instanceSpec":{
"existed":true,
"existedOption":{
"existedInstanceID":"i-SxeBLkcN",
"rebuild":true
},
"machineType":"BCC",
"instanceOS": {
"imageName": "7.5 x86_64 (64bit)",
"imageType": "System",
"osType": "linux",
"osName": "CentOS",
"osVersion": "7.5",
"osArch": "x86_64 (64bit)"
},
"adminPassword":"test123!T"
}
}
],
"nodes":[
{
"instanceSpec":{
"existed":true,
"existedOption":{
"existedInstanceID":"i-M56Un1DO",
"rebuild":true
},
"machineType":"BCC",
"instanceOS": {
"imageName": "7.5 x86_64 (64bit)",
"imageType": "System",
"osType": "linux",
"osName": "CentOS",
"osVersion": "7.5",
"osArch": "x86_64 (64bit)"
},
"adminPassword":"test123!T"
}
}
]
}
Request Example: Attach CDS
Sometimes, when we want to mount one or more CDSs to the node in creating nodes, we can set the CDS parameters and related mounting paths for the node in creating a cluster. The example is as follows:
It should be noted that only one CDS can be mounted in one path, but another CDS can be mounted in a sub-path of the path. For example, only one CDS can be mounted under the /a directory, but you can mount another CDS under the /a/b directory.
For existing nodes, you can only mount the CDS in the specified path and cannot create a CDS. Therefore, when an existing node tries to mount the CDS to the specified Path but cannot find a desirable CDS, then it will ignore the CDS configuration.
{
......
"masters":[
{
"instanceSpec":{
......
"instanceResource": {
"cdsList": [
{diskPath: "/home/cce", storageType: "cloud_hp1", cdsSize: 50}
]
},
......
}
}
],
"nodes":[
{
"instanceSpec":{
......
"instanceResource": {
"cdsList": [
{diskPath: "/home/cce", storageType: "cloud_hp1", cdsSize: 60}
]
},
......
}
}
]
}
Return Example
HTTP/1.1 200 OK
x-bce-request-id: d2ce8f50-529a-4663-9265-ad08c94633c8
Date: Thu, 16 Mar 2020 06:29:48 GMT
Content-Type: application/json;charset=UTF-8
{
"clusterID": "cce-NqYwWEhu",
"requestID": "d2ce8f50-529a-4663-9265-ad08c94633c8"
}
Cluster List
Description
Query the user CCE K8S cluster list.
Request Structure
GET /v2/clusters HTTP/1.1
Host: cce.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Request Header Fields
No other special header fields are available, except for common header fields.
Request Parameter
Parameter Name | Type | Required or not | Parameter Position | Description |
---|---|---|---|---|
keywordType | String | No | Query parameter | The cluster fuzzy query field. You can select it between [clusterName and clusterID]. Its default value is clusterName. |
keyword | String | No | Query parameter | The query keyword. Its default value is an empty string. |
orderBy | String | No | Query parameter | The cluster query sorting field. You can select it among [clusterName, clusterID, and createdAt]. Its default value is clusterName. |
order | String | No | Query parameter | The sorting method. You can select it between [ASC and DESC]. ASC represents the ascending order and DESC the descending order. Its default value is ASC. |
pageNo | Integer | No | Query parameter | The page number, whose default value is 1. |
pageSize | Integer | No | Query parameter | The number of results on a single page. Its default value is 10. |
Return Header Field
No other special header fields are available, except for common header fields.
Return Parameters
Parameter Name | Type | Description | Description |
---|---|---|---|
clusterPage | ClusterPage | Yes | The return results of cluster paging query |
requestID | String | Yes | The request ID, which is provided by the problem location. |
Request Example
GET /v2/clusters?keywordType=clusterName&keyword=&orderBy=clusterID&order=ASC&pageNo=1&pageSize=10 HTTP/1.1
Host: cce.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Return Example
HTTP/1.1 200 OK
X-Bce-Request-Id: 97342dc7-29a1-4ed9-a75d-904bb293d295
Date: Thu, 16 Mar 2020 06:29:48 GMT
Content-Type: application/json;charset=UTF-8
{
"clusterPage": {
"keywordType": "clusterName",
"keyword": "",
"orderBy": "clusterID",
"order": "ASC",
"pageNo": 1,
"pageSize": 10,
"totalCount": 1,
"clusterList": [
{
"spec": {
"clusterID": "cce-shpdaa9l",
"clusterName": "sdk-ccev2-test",
"clusterType": "normal",
"description": "",
"k8sVersion": "1.16.8",
"vpcID": "vpc-aj2rcjm084y5",
"vpcCIDR": "192.168.0.0/16",
"plugins": [
"ip-masq-agent",
"core-dns",
"kube-proxy",
"metrics-server",
"nvidia-gpu"
],
"masterConfig": {
"masterType": "managed",
"clusterHA": 1,
"clusterBLBVPCSubnetID": "sbn-0dizryuc81c0",
"managedClusterMasterOption": {
"masterVPCSubnetZone": "zoneA"
}
},
"containerNetworkConfig": {
"mode": "kubenet",
"ipVersion": "ipv4",
"lbServiceVPCSubnetID": "sbn-0dizryuc81c0",
"nodePortRangeMin": 30000,
"nodePortRangeMax": 32767,
"clusterPodCIDR": "172.28.0.0/16",
"clusterIPServiceCIDR": "172.31.0.0/16",
"maxPodsPerNode": 128,
"kubeProxyMode": "ipvs"
}
},
"status": {
"clusterBLB": {
"id": "lb-1454d5c4",
"vpcIP": "100.64.230.44",
"eip": ""
},
"clusterPhase": "running",
"nodeNum": 0
},
"createdAt": "2020-09-04T01:58:12Z",
"updatedAt": "2020-09-04T02:00:37Z"
}
]
},
"requestID": "97342dc7-29a1-4ed9-a75d-904bb293d295"
}
Cluster Details
Description
Queries details on the specified cluster.
Request Structure
GET /v2/cluster/{clusterID} HTTP/1.1
Host: cce.bj.baidubce.com
Authorization: authorization string
Request Header Fields
No other special header fields are available, except for common header fields.
Request Parameter
Parameter Name | Type | Required or not | Parameter Position | Description |
---|---|---|---|---|
clusterID | String | Yes | URL parameter | Cluster ID |
Return Header Field
No other special header fields are available, except for common header fields.
Return Parameters
Parameter Name | Type | Required or not | Description |
---|---|---|---|
Cluster | Cluster | Yes | The cluster detail query results |
requestID | String | Yes | The request ID, which is provided by the problem location. |
Request Example
GET /v2/cluster/cce-zyt88sqy HTTP/1.1
Host: cce.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Return Example
HTTP/1.1 200 OK
X-Bce-Request-Id: 928a21b5-d117-4a83-a274-fd7d6f413524
Date: Thu, 16 Mar 2020 06:29:48 GMT
Content-Type: application/json;charset=UTF-8
{
"cluster": {
"spec": {
"clusterID": "cce-shpdaa9l",
"clusterName": "sdk-ccev2-test",
"clusterType": "normal",
"description": "",
"k8sVersion": "1.16.8",
"vpcID": "vpc-aj2rcjm084y5",
"vpcCIDR": "192.168.0.0/16",
"plugins": [
"ip-masq-agent",
"core-dns",
"kube-proxy",
"metrics-server",
"nvidia-gpu"
],
"masterConfig": {
"masterType": "managed",
"clusterHA": 1,
"clusterBLBVPCSubnetID": "sbn-0dizryuc81c0",
"managedClusterMasterOption": {
"masterVPCSubnetZone": "zoneA"
}
},
"containerNetworkConfig": {
"mode": "kubenet",
"ipVersion": "ipv4",
"lbServiceVPCSubnetID": "sbn-0dizryuc81c0",
"nodePortRangeMin": 30000,
"nodePortRangeMax": 32767,
"clusterPodCIDR": "172.28.0.0/16",
"clusterIPServiceCIDR": "172.31.0.0/16",
"maxPodsPerNode": 128,
"kubeProxyMode": "ipvs"
}
},
"status": {
"clusterBLB": {
"id": "lb-1454d5c4",
"vpcIP": "100.64.230.44",
"eip": ""
},
"clusterPhase": "running",
"nodeNum": 0
},
"createdAt": "2020-09-04T01:58:12Z",
"updatedAt": "2020-09-04T02:00:37Z"
},
"requestID": "928a21b5-d117-4a83-a274-fd7d6f413524"
}
Delete Cluster
Description
Deletes the specified cluster.
Request Structure
DELETE /v2/cluster/{clusterID} HTTP/1.1
Host: cce.bj.baidubce.com
Authorization: authorization string
Request Header Fields
No other special header fields are available, except for common header fields.
Request Parameter
Parameter Name | Type | Required or not | Parameter Position | Description |
---|---|---|---|---|
clusterID | String | Yes | URL parameter | The cluster ID |
deleteResource | Boolean | No | Query parameter | Whether to delete relevant resources (postpaid public network IP and cloud disk storage). Its default value is false. |
deleteCDSSnapshot | Boolean | No | Query parameter | Whether to delete the cloud disk storage snapshot. Its default value is false. |
Return Header Field
No other special header fields are available, except for common header fields.
Return Parameters
Parameter Name | Type | Required or not | Description |
---|---|---|---|
requestID | String | Yes | The request ID, which is provided by the problem location. |
Request Example
DELETE /v2/cluster/cce-uqc4lju1?deleteResource=true&deleteCDSSnapshot=true HTTP/1.1
Host: cce.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2019-03-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Return Example
HTTP/1.1 200 OK
X-Bce-Request-Id: 105ce04b-1a42-4f77-9d22-ab6f413f9d69
Date: Thu, 16 Mar 2020 06:29:48 GMT
Content-Type: application/json;charset=UTF-8
{
"requestID": "105ce04b-1a42-4f77-9d22-ab6f413f9d69"
}