pydo.kubernetes.create_cluster()
Generated on 16 Jun 2025
from pydo
version
v0.11.0
Description
To create a new Kubernetes cluster, send a POST request to
/v2/kubernetes/clusters
. The request must contain at least one node pool
with at least one worker.
The request may contain a maintenance window policy describing a time period when disruptive maintenance tasks may be carried out. Omitting the policy implies that a window will be chosen automatically. See here for details.
Request Sample
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
req = {
"name": "prod-cluster-01",
"region": "nyc1",
"version": "1.18.6-do.0",
"node_pools": [
{
"size": "s-1vcpu-2gb",
"count": 3,
"name": "worker-pool"
}
]
}
resp = client.kubernetes.create_cluster(body=req)
More Information
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.