Skip to content

Create Kubernetes Cluster

POST
/api/v1/kubernetes/
curl --request POST \
--url 'https://api.e2enetworks.com/myaccount/api/v1/kubernetes/?project_id=<PROJECT_ID>&apikey=<API_KEY>&location=<LOCATION>' \
--header 'Authorization: Bearer <API_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "my-k8s-cluster",
"version": "1.32",
"slug_name": "C3-4vCPU-8RAM-100DISK-3rdGen-K8s1_32-master-metal-lb-Delhi",
"vpc_id": 12345,
"subnet_id": null,
"sku_id": 1178,
"security_group_id": 12345,
"isEncryptionEnabled": true,
"encryption_passphrase": "<encryption-passphrase>",
"node_pools": [
{
"name": "pool-worker-1",
"slug_name": "C3-4vCPU-8RAM-100DISK-C3.96GB - CentOS-Stream-Delhi",
"sku_id": 1088,
"specs_name": "C3.8GB",
"policy_type": "Default-Scheduled",
"elasticity_dict": {
"worker": {
"min_vms": 3,
"cardinality": 3,
"max_vms": 5,
"elasticity_policies": [
{
"type": "CHANGE",
"adjust": 1,
"parameter": "CPU",
"operator": ">",
"value": 60,
"period_number": 3,
"period": 10,
"cooldown": 150
},
{
"type": "CHANGE",
"adjust": -1,
"parameter": "CPU",
"operator": "<",
"value": 30,
"period_number": 3,
"period": 10,
"cooldown": 150
}
]
}
},
"scheduled_dict": {
"worker": {
"min_vms": 3,
"cardinality": 3,
"max_vms": 5,
"scheduled_policies": [
{
"type": "CARDINALITY",
"adjust": 3,
"recurrence": "0 12 * * *"
},
{
"type": "CARDINALITY",
"adjust": 3,
"recurrence": "0 2 * * *"
}
]
}
}
}
]
}'

Provisions a managed Kubernetes cluster. The cluster is created with a single master node (sized by sku_id from Master Plan) and one or more worker node pools (node_pools, 1-10 pools). Each node pool runs identical worker nodes from the selected worker plan and can define elastic (metric based) and/or scheduled (cron based) autoscaling via elasticity_dict and scheduled_dict.

The cluster must be attached to a VPC (vpc_id, which must be in the Running state), and can optionally attach a security group and enable disk encryption. On success the cluster is returned in a Creating state - poll List or Detail until it reaches Running.

project_id
required
integer

Identifier of the project to scope the request to. Required integer project ID.

Example

<PROJECT_ID>
apikey
required
string

API key used to authenticate the create request.

Example

<API_KEY>
location
required
string

Region in which the cluster will be provisioned.

Example

<LOCATION>
Media typeapplication/json

Create payload for a Kubernetes cluster. Send the master node sizing (sku_id, version, slug_name), the VPC to attach (vpc_id), and one or more worker node_pools (1-10). For each node pool, send elasticity_dict for metric-based scaling, scheduled_dict for cron-based scaling, or both - and set policy_type accordingly.

object
name
required

Display name of the cluster.

string

Example

my-k8s-cluster
version
required

Kubernetes version for the cluster. Must be a version supported by the selected master image (slug_name).

string

Example

1.32
slug_name
required

Master plan slug (the plan string from Master Plan). The region must support managed Kubernetes.

string

Example

C3-4vCPU-8RAM-100DISK-3rdGen-K8s1_32-master-metal-lb-Delhi
vpc_id
required

ID of the VPC network to attach the cluster to.

integer

Example

12345
subnet_id

ID of the subnet within the VPC to place the cluster in.

integer
nullable

Example

null
sku_id
required

SKU ID of the master node plan (a specs.id from Master Plan).

integer

Example

1178
security_group_id

ID of a security group to attach to the cluster nodes at create time.

integer

Example

12345
isEncryptionEnabled

Whether to enable disk encryption on the cluster nodes.

boolean

Example

true
encryption_passphrase

Passphrase used to encrypt the disks. Required when isEncryptionEnabled is true.

string

Example

<encryption-passphrase>
node_pools
required

Worker node pools to create with the cluster.

Array<object>
object
name
required

Display name of the node pool.

string

Example

pool-worker-1
slug_name
required

Worker plan slug (the plan string from Worker Plan).

string

Example

C3-4vCPU-8RAM-100DISK-C3.96GB - CentOS-Stream-Delhi
sku_id
required

SKU ID of the worker plan (a specs.id from Worker Plan).

integer

Example

1088
specs_name

Human-readable plan/spec name for the worker nodes.

string

Example

C3.8GB
policy_type

Scaling policy mode for the pool. Required when elasticity_dict or scheduled_dict is supplied.

string

Example

Default-Scheduled
elasticity_dict

Elastic (metric-based) autoscaling configuration, keyed by role (worker).

object
worker
object
min_vms

Minimum number of worker nodes.

integer

Example

3
cardinality

Initial (desired) number of worker nodes.

integer

Example

3
max_vms

Maximum number of worker nodes the pool may scale to.

integer

Example

5
elasticity_policies

Elastic scaling rules, sent as two objects - a scale-up rule (adjust: 1) and a scale-down rule (adjust: -1).

Array<object>
object
type

Policy type; use “CHANGE” for a relative adjustment.

string

Example

CHANGE
adjust

Number of nodes to add (positive) or remove (negative) when the rule fires.

integer

Example

1
parameter

Metric the rule watches.

string

Example

CPU
operator

Comparison operator applied to the metric.

string

Example

>
value

Threshold percentage the metric is compared against.

integer

Example

60
period_number

Number of consecutive evaluation periods the condition must hold before the rule fires.

integer

Example

3
period

Duration of one evaluation period, in seconds.

integer

Example

10
cooldown

Cooldown after scaling, in seconds, before the rule can fire again.

integer

Example

150
scheduled_dict

Scheduled (cron-based) autoscaling configuration, keyed by role (worker).

object
worker
object
min_vms
integer

Example

3
cardinality
integer

Example

3
max_vms
integer

Example

5
scheduled_policies

Scheduled scaling rules that set the node count on a cron schedule.

Array<object>
object
type

Use “CARDINALITY” to set an absolute target node count.

string

Example

CARDINALITY
adjust

Target number of worker nodes when the schedule fires.

integer

Example

3
recurrence

Cron expression for when the rule fires. Must be a valid cron.

string

Example

0 12 * * *

Example

{
"name": "my-k8s-cluster",
"version": "1.32",
"slug_name": "C3-4vCPU-8RAM-100DISK-3rdGen-K8s1_32-master-metal-lb-Delhi",
"vpc_id": 12345,
"subnet_id": null,
"sku_id": 1178,
"security_group_id": 12345,
"isEncryptionEnabled": true,
"encryption_passphrase": "<encryption-passphrase>",
"node_pools": [
{
"name": "pool-worker-1",
"slug_name": "C3-4vCPU-8RAM-100DISK-C3.96GB - CentOS-Stream-Delhi",
"sku_id": 1088,
"specs_name": "C3.8GB",
"policy_type": "Default-Scheduled",
"elasticity_dict": {
"worker": {
"min_vms": 3,
"cardinality": 3,
"max_vms": 5,
"elasticity_policies": [
{
"type": "CHANGE",
"adjust": 1,
"parameter": "CPU",
"operator": ">",
"value": 60,
"period_number": 3,
"period": 10,
"cooldown": 150
},
{
"type": "CHANGE",
"adjust": -1,
"parameter": "CPU",
"operator": "<",
"value": 30,
"period_number": 3,
"period": 10,
"cooldown": 150
}
]
}
},
"scheduled_dict": {
"worker": {
"min_vms": 3,
"cardinality": 3,
"max_vms": 5,
"scheduled_policies": [
{
"type": "CARDINALITY",
"adjust": 3,
"recurrence": "0 12 * * *"
},
{
"type": "CARDINALITY",
"adjust": 3,
"recurrence": "0 2 * * *"
}
]
}
}
}
]
}

Successful response

Media typeapplication/json

On success the cluster is created in a Creating state.

object
code
integer
data
object
DOCUMENT
object
ID
string
NAME
string
TEMPLATE
object
BODY
object
name
string
deployment
string
roles
Array<object>
object
name
string
cardinality
integer
state
integer
state
integer
errors
object
message
string

Example

{
"code": 201,
"data": {
"DOCUMENT": {
"ID": "12345",
"NAME": "my-k8s-cluster",
"TEMPLATE": {
"BODY": {
"name": "my-k8s-cluster",
"deployment": "straight",
"roles": [
{
"name": "master",
"cardinality": 1,
"state": 0
}
],
"state": 0
}
}
}
},
"message": "Success"
}