Logo
OpenScaler

Create Kubernetes cluster

POST
/v1/kubernetes/clusters

Create a new managed Kubernetes cluster.

Creation is asynchronous — progress events are streamed as Server-Sent Events (SSE). You can also subscribe to GET /v1/events/create-k8s-cluster/{sequence_id} using the same sequence_id from the request body.

Authorization

bearer_auth
AuthorizationBearer <token>

OAuth Authentication

OpenScaler API uses OAuth, a standard for secure authorization. To access the API, obtain a token via the OpenScaler Platform.

Use the access_token in the Authorization header for requests:

Authorization: Bearer <token>

Always keep your token secure and do not share it with anyone.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Request body for creating a managed Kubernetes cluster.

Response Body

text/event-stream

application/json

text/pain

application/json

application/json

curl -X POST "https://example.com/v1/kubernetes/clusters" \  -H "Content-Type: application/json" \  -d '{    "sequence_id": 123456,    "name": "my-cluster",    "region": "alg1",    "node_count": 1,    "project_id": "default",    "version": "1.32.2",    "size": "b-2-4-100",    "autoscale": false  }'
{  "event": "200",  "data": {    "id": "0193e8a2-7c4b-7b1e-9f3a-2d5c8e1f0a6b",    "user_id": "2abb7c25-a2d5-42ac-a776-e8ac5dfb16c3",    "project_id": "default",    "name": "my-cluster",    "description": "Production workloads",    "region": "alg1",    "vpc_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",    "api_endpoint": "https://k8s.example.com:6443",    "vpc_subnet": "10.0.20.0/24",    "public_ip": "10.99.88.77",    "os": "Debian 11",    "version": "1.32.2",    "size": "b-2-4-100",    "node_count": 1,    "status": "running",    "autoscale": false,    "min_nodes": 1,    "max_nodes": 6,    "tags": [],    "created_at": "2025-01-15T13:24:27Z",    "updated_at": "2025-01-15T13:24:27Z"  }}
{  "errors": [    {      "message": "'vcpus' field must be an integer",      "field": "resource_id"    }  ]}
"Access denied"
{  "errors": [    {      "message": "User not initialized (missing required fields in token), please init user by sending POST request to `/v1/init` then refresh your token\n"    }  ]}
{  "errors": [    {      "message": "VM with ID 23 not found"    }  ]}