Create a cluster
Requests
HTTP request
POST /apis/platform.tkestack.io/v1/clusters
create a Cluster
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| dryRun | string | False | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
| fieldManager | string | False | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
| pretty | string | False | If 'true', then the output is pretty printed. |
Request body
Content-Type
*/*
Sample request
Cluster is a Kubernetes cluster in
{
"apiVersion": "platform.tkestack.io/v1",
"kind": "Cluster",
"metadata": {
"annotations": {
"cpaas.io/network-type": "kube-ovn"
},
"name": "cluster-name"
},
"spec": {
"clusterCIDR": "10.199.0.0/16",
"displayName": "Global",
"dnsDomain": "cluster.local",
"features": {
"enableMasterSchedule": true,
"files": [
{
"dst": "/etc/kubernetes/audit/policy.yaml",
"src": "/app/provider/baremetal/audit/policy.yaml"
}
],
"ha": {
"thirdParty": {
"vip": "192.168.1.100",
"vport": 6443
}
},
"ipvs": true,
"skipConditions": [
"EnsureGalaxy"
]
},
"machines": [
{
"displayName": "",
"ip": "192.168.1.101",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"password": "cGFzc3dvcmQ=",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
},
{
"displayName": "",
"ip": "192.168.1.102",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"password": "cGFzc3dvcmQ=",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
},
{
"displayName": "",
"ip": "192.168.1.103",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"password": "cGFzc3dvcmQ=",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
}
],
"networkDevice": "eth0",
"properties": {
"maxNodePodNum": 256
},
"serviceCIDR": "10.96.0.0/12",
"tenantID": "default",
"type": "Baremetal",
"version": "1.19.9"
}
}Parmeters
| Name | Type | Required | Description |
|---|---|---|---|
| apiVersion | string | True | See common parameters |
| kind | string | True | See common parameters |
| metadata | object | True | See common parameters |
| spec | object | True |
ClusterSpec is a description of a cluster.
Path: spec |
| spec.clusterCIDR | string | True |
ClusterCIDR is used to set a separated CIDR for k8s pod
Path: spec.clusterCIDR |
| spec.displayName | string | True |
DisplayName is the display name of the cluster.
Path: spec.displayName |
| spec.dnsDomain | string | True |
DNSDomain is the dns domain used by k8s services. Defaults to "cluster.local".
Path: spec.dnsDomain |
| spec.features | object | True |
ClusterFeature records the features that are enabled by the cluster.
Path: spec.features |
| features.enableMasterSchedule | boolean | True |
enable master node schedule or not
Path: spec.features.enableMasterSchedule |
| features.files | array | True |
files
Path: spec.features.files |
| features.files[] | object | True |
Path: spec.features.files[] |
| files[].dst | string | True |
destination file, only support regular file
Path: spec.features.files[].dst |
| files[].src | string | True |
source file, only support regular file
Path: spec.features.files[].src |
| features.ha | object | True |
Path: spec.features.ha |
| ha.thirdParty | object | True |
Path: spec.features.ha.thirdParty |
| thirdParty.vip | string | True |
virtual IP of the HA
Path: spec.features.ha.thirdParty.vip |
| thirdParty.vport | integer (int32) | True |
virtual port of the HA
Path: spec.features.ha.thirdParty.vport |
| features.ipvs | boolean | True |
ipvs on-off
Path: spec.features.ipvs |
| features.skipConditions | array | True |
SkipConditions is a set of conditions that needs to be skipped
Path: spec.features.skipConditions |
| features.skipConditions[] | string | True |
Path: spec.features.skipConditions[] |
| spec.machines | array | True |
cluster machine, represent master nodes in the cluster
Path: spec.machines |
| spec.machines[] | object | True |
ClusterMachine is the master machine definition of cluster.
Path: spec.machines[] |
| machines[].displayName | string | True |
displayName
Path: spec.machines[].displayName |
| machines[].ip | string | True |
Path: spec.machines[].ip |
| machines[].ipv6 | string | True |
ipv6
Path: spec.machines[].ipv6 |
| machines[].labels | object | True |
Path: spec.machines[].labels |
| machines[].networkDevice | string | True |
networkDevice
Path: spec.machines[].networkDevice |
| machines[].password | string (byte) | True |
Path: spec.machines[].password |
| machines[].port | integer (int32) | True |
Path: spec.machines[].port |
| machines[].proxy | object | True |
MachineProxy is the proxy to connect Machine's ssh.
Path: spec.machines[].proxy |
| machines[].publicIP | string | True |
publicIP
Path: spec.machines[].publicIP |
| machines[].role | string | True |
master/node
Path: spec.machines[].role |
| machines[].username | string | True |
Path: spec.machines[].username |
| spec.networkDevice | string | True |
network device
Path: spec.networkDevice |
| spec.properties | object | True |
ClusterProperty records the attribute information of the cluster.
Path: spec.properties |
| properties.maxNodePodNum | integer (int32) | True |
max number of node pod
Path: spec.properties.maxNodePodNum |
| spec.serviceCIDR | string | True |
ServiceCIDR is used to set a separated CIDR for k8s service, it's exclusive with MaxClusterServiceNum.
Path: spec.serviceCIDR |
| spec.tenantID | string | True |
tenant id
Path: spec.tenantID |
| spec.type | string | True |
cluster type, baremetal or imported
Path: spec.type |
| spec.version | string | True |
cluster version
Path: spec.version |
Responses
Content-Type
application/json,
application/yaml,
application/vnd.kubernetes.protobuf
Status code: 201
Created
Sample response
Cluster is a Kubernetes cluster in
{
"apiVersion": "platform.tkestack.io/v1",
"kind": "Cluster",
"metadata": {
"annotations": {
"cpaas.io/network-type": "kube-ovn",
"platform.tkestack.io/galaxy-ipam-ip": "10.96.0.8",
"platform.tkestack.io/gpu-quota-admission-ip": "10.96.0.9"
},
"name": "cluster-name",
"resourceVersion": "23234",
"selfLink": "/apis/platform.tkestack.io/v1/clusters/cluster-name",
"uid": "6cc56a49-8ac3-45ea-916c-10fb35b94723"
},
"spec": {
"clusterCIDR": "10.199.0.0/16",
"displayName": "Global",
"dnsDomain": "cluster.local",
"features": {
"enableMasterSchedule": true,
"files": [
{
"dst": "/etc/kubernetes/audit/policy.yaml",
"src": "/app/provider/baremetal/audit/policy.yaml"
}
],
"ha": {
"thirdParty": {
"vip": "192.168.1.100",
"vport": 6443
}
},
"ipvs": true,
"skipConditions": [
"EnsureGalaxy",
"EnsureNvidiaDriver",
"EnsureMetricsServer"
],
"upgrade": {
"mode": "Auto",
"strategy": {
"drainNodeBeforeUpgrade": false,
"maxUnready": 0
}
}
},
"finalizers": [
"cluster"
],
"machines": [
{
"displayName": "",
"ip": "192.168.1.101",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"password": "cGFzc3dvcmQ=",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
},
{
"displayName": "",
"ip": "192.168.1.102",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"password": "cGFzc3dvcmQ=",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
},
{
"displayName": "",
"ip": "192.168.1.103",
"ipv6": "",
"labels": {
"node-role.kubernetes.io/master": "",
"nvidia-device-enable": "false"
},
"networkDevice": "",
"password": "cGFzc3dvcmQ=",
"port": 22,
"proxy": {},
"publicIP": "",
"role": "",
"username": "root"
}
],
"networkDevice": "eth0",
"properties": {
"maxNodePodNum": 256
},
"serviceCIDR": "10.96.0.0/12",
"tenantID": "default",
"type": "Baremetal",
"version": "1.19.9"
},
"status": {
"phase": "Initializing"
}
}Parameters
| Name | Type | Description |
|---|---|---|
| apiVersion | string | See common parameters |
| kind | string | See common parameters |
| metadata | object | See common parameters |
| spec | object |
ClusterSpec is a description of a cluster.
Path: spec |
| spec.clusterCIDR | string |
ClusterCIDR is used to set a separated CIDR for k8s pod
Path: spec.clusterCIDR |
| spec.displayName | string |
DisplayName is the display name of the cluster.
Path: spec.displayName |
| spec.dnsDomain | string |
DNSDomain is the dns domain used by k8s services. Defaults to "cluster.local".
Path: spec.dnsDomain |
| spec.features | object |
ClusterFeature records the features that are enabled by the cluster.
Path: spec.features |
| features.enableMasterSchedule | boolean |
enable master node schedule or not
Path: spec.features.enableMasterSchedule |
| features.files | array |
files
Path: spec.features.files |
| features.files[] | object |
Path: spec.features.files[] |
| files[].dst | string |
destination file, only support regular file
Path: spec.features.files[].dst |
| files[].src | string |
source file, only support regular file
Path: spec.features.files[].src |
| features.ha | object |
Path: spec.features.ha |
| ha.thirdParty | object |
Path: spec.features.ha.thirdParty |
| thirdParty.vip | string |
virtual IP of the HA
Path: spec.features.ha.thirdParty.vip |
| thirdParty.vport | integer (int32) |
virtual port of the HA
Path: spec.features.ha.thirdParty.vport |
| features.ipvs | boolean |
ipvs on-off
Path: spec.features.ipvs |
| features.skipConditions | array |
SkipConditions is a set of conditions that needs to be skipped
Path: spec.features.skipConditions |
| features.skipConditions[] | string |
Path: spec.features.skipConditions[] |
| features.upgrade | object |
Path: spec.features.upgrade |
| upgrade.mode | string |
Upgrade mode, default value is Auto.
Path: spec.features.upgrade.mode |
| upgrade.strategy | object |
UpgradeStrategy used to control the upgrade process.
Path: spec.features.upgrade.strategy |
| strategy.drainNodeBeforeUpgrade | boolean |
Whether drain node before upgrade. Draining node before upgrade is recommended. But not all pod running as cows, a few running as pets. If your pod can not accept be expelled from current node, this value should be false.
Path: spec.features.upgrade.strategy.drainNodeBeforeUpgrade |
| strategy.maxUnready | string (int-or-string) |
IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.
Path: spec.features.upgrade.strategy.maxUnready |
| spec.finalizers | array |
Finalizers is an opaque list of values that must be empty to permanently remove object from storage.
Path: spec.finalizers |
| spec.finalizers[] | string |
Path: spec.finalizers[] |
| spec.machines | array |
cluster machine, represent master nodes in the cluster
Path: spec.machines |
| spec.machines[] | object |
ClusterMachine is the master machine definition of cluster.
Path: spec.machines[] |
| machines[].displayName | string |
displayName
Path: spec.machines[].displayName |
| machines[].ip | string |
Path: spec.machines[].ip |
| machines[].ipv6 | string |
ipv6
Path: spec.machines[].ipv6 |
| machines[].labels | object |
Path: spec.machines[].labels |
| machines[].networkDevice | string |
networkDevice
Path: spec.machines[].networkDevice |
| machines[].password | string (byte) |
Path: spec.machines[].password |
| machines[].port | integer (int32) |
Path: spec.machines[].port |
| machines[].proxy | object |
MachineProxy is the proxy to connect Machine's ssh.
Path: spec.machines[].proxy |
| machines[].publicIP | string |
publicIP
Path: spec.machines[].publicIP |
| machines[].role | string |
master/node
Path: spec.machines[].role |
| machines[].username | string |
Path: spec.machines[].username |
| spec.networkDevice | string |
network device
Path: spec.networkDevice |
| spec.properties | object |
ClusterProperty records the attribute information of the cluster.
Path: spec.properties |
| properties.maxNodePodNum | integer (int32) |
max number of node pod
Path: spec.properties.maxNodePodNum |
| spec.serviceCIDR | string |
ServiceCIDR is used to set a separated CIDR for k8s service, it's exclusive with MaxClusterServiceNum.
Path: spec.serviceCIDR |
| spec.tenantID | string |
tenant id
Path: spec.tenantID |
| spec.type | string |
cluster type, baremetal or imported
Path: spec.type |
| spec.version | string |
cluster version
Path: spec.version |
| status | object |
ClusterStatus represents information about the status of a cluster.
Path: status |
| status.phase | string |
cluster phase
Path: status.phase |