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 * * *" } ] } } } ]}'import requests
response = requests.post( "https://api.e2enetworks.com/myaccount/api/v1/kubernetes/", params={"project_id": "<PROJECT_ID>", "apikey": "<API_KEY>", "location": "<LOCATION>"}, headers={"Authorization": "Bearer <API_TOKEN>"}, json={ "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": None, "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 * * *", }, ], }, }, }, ], },)print(response.json())const url = new URL("https://api.e2enetworks.com/myaccount/api/v1/kubernetes/");url.search = new URLSearchParams({ project_id: "<PROJECT_ID>", apikey: "<API_KEY>", location: "<LOCATION>" });
const response = await fetch(url, { method: "POST", headers: { "Authorization": "Bearer <API_TOKEN>", "Content-Type": "application/json" }, body: JSON.stringify({ "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 * * *" } ] } } } ] }),});console.log(await response.json());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.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Identifier of the project to scope the request to. Required integer project ID.
Example
<PROJECT_ID>API key used to authenticate the create request.
Example
<API_KEY>Region in which the cluster will be provisioned.
Example
<LOCATION>Request Body
Section titled “Request Body”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
Display name of the cluster.
Example
my-k8s-clusterKubernetes version for the cluster. Must be a version supported by the selected master image (slug_name).
Example
1.32Master plan slug (the plan string from Master Plan). The region must support managed Kubernetes.
Example
C3-4vCPU-8RAM-100DISK-3rdGen-K8s1_32-master-metal-lb-DelhiID of the VPC network to attach the cluster to.
Example
12345ID of the subnet within the VPC to place the cluster in.
Example
nullSKU ID of the master node plan (a specs.id from Master Plan).
Example
1178ID of a security group to attach to the cluster nodes at create time.
Example
12345Whether to enable disk encryption on the cluster nodes.
Example
truePassphrase used to encrypt the disks. Required when isEncryptionEnabled is true.
Example
<encryption-passphrase>Worker node pools to create with the cluster.
object
Display name of the node pool.
Example
pool-worker-1Worker plan slug (the plan string from Worker Plan).
Example
C3-4vCPU-8RAM-100DISK-C3.96GB - CentOS-Stream-DelhiSKU ID of the worker plan (a specs.id from Worker Plan).
Example
1088Human-readable plan/spec name for the worker nodes.
Example
C3.8GBScaling policy mode for the pool. Required when elasticity_dict or scheduled_dict is supplied.
Example
Default-ScheduledElastic (metric-based) autoscaling configuration, keyed by role (worker).
object
object
Minimum number of worker nodes.
Example
3Initial (desired) number of worker nodes.
Example
3Maximum number of worker nodes the pool may scale to.
Example
5Elastic scaling rules, sent as two objects - a scale-up rule (adjust: 1) and a scale-down rule (adjust: -1).
object
Policy type; use “CHANGE” for a relative adjustment.
Example
CHANGENumber of nodes to add (positive) or remove (negative) when the rule fires.
Example
1Metric the rule watches.
Example
CPUComparison operator applied to the metric.
Example
>Threshold percentage the metric is compared against.
Example
60Number of consecutive evaluation periods the condition must hold before the rule fires.
Example
3Duration of one evaluation period, in seconds.
Example
10Cooldown after scaling, in seconds, before the rule can fire again.
Example
150Scheduled (cron-based) autoscaling configuration, keyed by role (worker).
object
object
Example
3Example
3Example
5Scheduled scaling rules that set the node count on a cron schedule.
object
Use “CARDINALITY” to set an absolute target node count.
Example
CARDINALITYTarget number of worker nodes when the schedule fires.
Example
3Cron expression for when the rule fires. Must be a valid cron.
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 * * *" } ] } } } ]}Responses
Section titled “Responses”Successful response
On success the cluster is created in a Creating state.
object
object
object
object
object
object
object
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"}