CreateCluster
Description
call CreateCluster to create a standard Kubernetes proprietary cluster.
Request Method
POST
Request Path
/apsara/route/CS/CreateCluster
Request Parameters Common Parameters
Name | Location | Type | Required | Sample value | Description |
---|---|---|---|---|---|
cluster_domain | BODY | string | No | cluster.local | cluster local domain name. naming rule: the domain name consists of one or more parts separated by decimal points (.), each part is up to 63 characters, lowercase letters, numbers and dashes (-) can be used, and the beginning and end must be lowercase letters or numbers. |
master_instance_types | BODY | array of string | Yes | ecs.n4.xlarge | Master node instance type. For more information about ECS instance specifications, see cloud server user guide instance specifications . |
worker_vswitch_ids | BODY | array of string | Yes | vsw-2ze3ds0mdip0hdz8i**** | virtual switch ID list, value range:[1,20]. To ensure high availability, it is recommended to select virtual switches with different available zones. |
addons | BODY | array of addon | No | No sample value for this parameter. | cluster component list, when creating a cluster, use addons to specify the cluster components to be installed. network component : required, there are two network types: Flannel and Terway. when creating a cluster, you can choose 1 of them: Flannel network:[{"name":"flannel","config":""}]. Terway network:[{"name": "terway-eniip","config": ""}]. storage component : required, support csi and flexvolume Two types: csi:[{"name": "csi-plugin","config": "" },{ "name": "csi-provisioner","config": ""}]. flexvolume:[{"name": "flexvolume","config": ""}]. log component : optional. It is recommended to enable the cluster audit function. If Log Service is not enabled, the cluster audit function will not be available. use existing SLS Project:[{"name": "logtail-ds","config": "{" IngressDashboardEnabled ": " true "," sls_project_name ": " your_sls_project_name "}"}]. create a new SLS Project:[{"name": "logtail-ds","config": "{" IngressDashboardEnabled ": " true "}"}]. Ingress component : optional, the default installation Ingress component nginx-ingress-controller. install the Ingress and enable the public network:[{"name":"nginx-ingress-controller","config":"{" IngressSlbNetworkType ":" internet "}"}]. prohibit the default installation Ingress:[{"name": "nginx-ingress-controller","config": "","disabled": true}]. event center : optional, open by default. event center provides the ability to store, query, and alert Kubernetes events. Logstore associated with Kubernetes event centers are free within 90 days. Enable event center:[{"name":"ack-node-problem-detector","config":"{" sls_project_name ":" your_sls_project_name "}"}]. |
proxy_mode | BODY | string | No | ipvs | kube-proxy proxy mode iptables: mature and stable kube-proxy proxy mode, kubernetes Service service discovery and load balancing are configured with iptables rules, but their performance is generally affected by scale, and they are suitable for clusters with a small number of service. ipvs: high-performance kube-proxy proxy mode, kubernetes Service service discovery and load balancing are configured using Linux IPVS modules, which is suitable for scenarios where clusters have a large number of Service and require high performance for load balancing. default value:ipvs. |
instances | BODY | array of string | No | i-2ze4zxnm36vq00xn**** | instance name. |
master_system_disk_category | BODY | string | Yes | cloud_ssd | Master node system disk type, value: cloud_efficiency: efficient cloud disk. cloud_ssd:SSD cloud disk. cloud_essd:ESSD cloud disk. default value:cloud_ssd. Default values may vary for different zones. |
cloud_monitor_flags | BODY | boolean | No | true | whether the cloud monitoring plug-in is installed in the cluster. Value: true: install the cloud monitoring plug-in. false: cloud monitoring plug-in is not installed. default value:false. |
ssh_flags | BODY | boolean | No | true | whether public SSH login is open. true: indicates open. false: indicates that it is not open. default value:false. |
container_cidr | BODY | string | Yes | 172.20.0.0/16 | Pod network address segment and cannot conflict with VPC network segment. When the system automatically creates a VPC, the 172.16.0.0/16 CIDR block is used by default. Note this field is required when creating a cluster of Flannel network types. this field does not need to be filled when creating a cluster of Terway network type. |
cluster_type | BODY | string | Yes | Kubernetes | cluster type. Value: Kubernetes:Kubernetes proprietary version ManagedKubernetes: edge managed cluster |
endpoint_public_access | BODY | boolean | No | true | whether to enable public access. Expose API Server through EIP to realize cluster public network access. true: open public access. false: public network access is not enabled. If you choose not to open, the cluster API Server cannot be accessed through the external network. default value:false. |
format_disk | BODY | boolean | No | false | When creating a cluster using an existing instance, whether to mount the data disk of the instance, value: true: store containers and images on the data disk, the original data in the data disk will be lost. Please pay attention to backup the data. false: does not store containers and images on the data disk. default value:false. data disk mounting rules: if the ECS has mounted the data disk and the file system of the last data disk is not initialized, the system will automatically format the data disk as ext4 to store the content/var/lib/docker,/var/lib/kubelet. If no data disk is mounted on the ECS instance, no new data disk will be mounted. |
platform | BODY | string | No | CentOS | operating system release. Value: CentOS AliyunLinux QbootAliyunLinux Qboot Windows WindowsCore default value:AliyunLinux. |
service_cidr | BODY | string | Yes | 172.21.0.0/20 | Service network address segment, optional range: 10.0.0.0/16-24,172.16-31.0.0/16-24,192.168.0.0/16-24 cannot be duplicated with VPC network segment 10.1.0.0/21 and the network segment used by existing Kubernetes clusters in VPC, and cannot be modified after successful creation. uses the 172.19.0.0/20 network segment by default. |
node_port_range | BODY | string | No | 30000~32767 | node service port, optional port range:[30000,65535]. default value:30000-32767. |
login_password | BODY | string | Yes | Hello@1234 | SSH login password, and key_pair choose 1. The password rule is 8 to 30 characters in length and contains at least three items (uppercase and lowercase letters, numbers, and special symbols). |
keep_instance_name | BODY | boolean | No | true | When creating a cluster using an existing instance, whether to keep the instance name. true: reserved. false: Not reserved, it will be replaced with system rules. default value:true. |
kubernetes_version | BODY | string | No | 1.16.9-aliyun.1 | cluster version, consistent with the Kubernetes community baseline version. It is recommended to select the latest version. If not specified, the latest version is used by default. Currently, you can create two latest versions of clusters in the ACK console. You can use API to create other Kubernetes versions of clusters. |
is_enterprise_security_group | BODY | boolean | No | true | automatically create enterprise security groups, it takes effect when security_group_id is empty. Note When using a normal security group, the sum of the number of nodes and Terway Pods in the cluster cannot exceed 2000. Therefore, when creating a Terway network cluster, we recommend that you use an enterprise security group. true: create and use enterprise security groups. false: enterprise security groups are not used. default value:true. |
master_system_disk_size | BODY | long | Yes | 120 | Master node system disk type, value range [40,500], unit: GiB. default value:120. |
master_count | BODY | long | No | 3 | Master number of nodes, optional value 3 or 5. default value:3. |
num_of_nodes | BODY | long | Yes | 3 | Worker nodes. The range is [0,100]. |
worker_instance_types | BODY | array of string | Yes | ecs.n4.large | Worker node instance specification, at least one instance specification must be specified. For more information, please refer to the ECS guide section instance specifications . Description The instance specification priority decreases as the position in the data increases. When an instance cannot be created based on an instance type with a higher priority, the instance type with the next priority is automatically selected to create the instance. |
deletion_protection | BODY | boolean | No | true | cluster deletion protection to prevent misdeletion of clusters through the console or API. Value: true: enable cluster deletion protection, and clusters cannot be deleted through the console or API. false: cluster deletion protection is not enabled, the cluster can be deleted through the console or API. default value:false. |
region_id | BODY | string | Yes | cn-beijing | the region ID of the cluster. |
snat_entry | BODY | boolean | No | true | Configure SNAT for the VPC. Value: true: NAT gateway will be created for you and SNAT rules will be automatically configured, if nodes and applications in your cluster need to access the public network, set it to true. false: does not create NAT gateways and SNAT rules for you. In this mode, nodes and applications in the cluster will not be able to access the public network. default value: true. |
user_ca | BODY | string | No | -----BEGIN CERTIFICATE-----**** | custom cluster CA. |
worker_system_disk_category | BODY | string | Yes | cloud_efficiency | Worker node system disk type, value: cloud_efficiency: efficient cloud disk. cloud_ssd:SSD cloud disk. default value:cloud_ssd. |
runtime | BODY | runtime | No | {"name": "docker", "version": "19.03.5"} | when the container is running, support containerd, docker, Sandboxed-Container.runv when, the default is docker. The runtime includes the following 2 messages: name: container runtime name. version: container runtime version. |
master_vswitch_ids | BODY | array of string | Yes | vsw-2ze3ds0mdip0hdz8i**** | virtual swap ID. |
user_data | BODY | string | No | IyEvdXNyL2Jpbi9iYXNoCmVjaG8gIkhlbGxvIEFD**** | custom node data. For more information, see instance custom data in ECS. |
taints | BODY | array of taint | No | No sample value for this parameter. | node taint information. Stain and tolerance (Toleration) cooperate with each other and can be used to prevent Pod from being assigned to inappropriate nodes. |
version | BODY | string | No | 2016-01-01 | version of api |
node_cidr_mask | BODY | string | No | 25 | the number of node IP. the number of IP is determined by specifying the CIDR of the network, which is only valid for Flannel network type clusters. default value:26. |
tags | BODY | array of tag | No | No sample value for this parameter. | node label. Label definition rules: tags consist of case-sensitive key-value pairs. you can set up to 20 tags. the tag key cannot be repeated, with a maximum length of 64 characters; The tag value can be empty and a maximum length of 128 characters. Neither the tag key nor the tag value can start with "aliyun", "acs:", "https://", or "http. |
OS _type | BODY | string | No | Linux | operating system platform type. Value: Windows Linux default value:Linux. |
timeout_mins | BODY | long | No | 60 | cluster creation timeout, in minutes. default value:60. |
regionId | BODY | string | Yes | No sample value for this parameter. | region id |
worker_system_disk_size | BODY | long | Yes | 120 | Worker node system disk size, unit is GiB. Value range:[40,500]. the value of this parameter must be greater than or equal to max{40, ImageSize}. default value: 120. |
vpcid | BODY | string | Yes | vpc-2zeik9h3ahvv2zz95**** | The proprietary network used by the cluster must be provided for the cluster when creating the cluster. |
cpu_policy | BODY | string | No | none | node CPU management policy. The following two policies are supported when the cluster version is 1.12.6 and above: static: allows Pods with certain resource characteristics on the node to enhance their CPU affinity and exclusivity. none: indicates that the existing default CPU affinity scheme is enabled. default value:none. |
name | BODY | string | Yes | cluster-demo | cluster name. naming rule: consists of numbers, Chinese characters, English characters, or dashes (-), and the length ranges from 1 to 63 characters, and cannot start with a dash (-). |
worker_data_disks | BODY | array | No | No sample value for this parameter. | a combination of configurations such as worker node data disk type and size. |
disable_rollback | BODY | boolean | No | true | whether the cluster creation fails to be rolled back. Value: true: when the cluster creation fails, the rollback operation is performed. false: When the cluster creation fails, no rollback operation is performed. default value:true. |
image_id | BODY | string | No | m-bp16z7xko3vvv8gt**** | node custom image, the system image is used by default. When custom image is selected, the default system image will be replaced. |
Return data
Name | Type | Sample value | Description |
---|---|---|---|
cluster_id | string | cb95aa626a47740afbf6aa099b650**** | cluster ID. |
task_id | string | T-5a54309c80282e39ea00002f | task ID. |
request_id | string | 687C5BAA-D103-4993-884B-C35E4314A1E1 | request ID. |
Example
Successful Response example
{
"cluster_id":"cb95aa626a47740afbf6aa099b650****",
"task_id":"T-5a54309c80282e39ea00002f",
"request_id":"687C5BAA-D103-4993-884B-C35E4314A1E1"
}
Failed Response example
{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}
}