To delete a Kubernetes cluster along with a subset of its associated resources,
send a DELETE request to /v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective
.
The JSON body of the request should include load_balancers
, volumes
, or
volume_snapshots
keys each set to an array of IDs for the associated
resources to be destroyed.
The IDs can be found by querying the cluster’s associated resources endpoint. Any associated resource not included in the request will remain and continue to accrue changes on your account.
Name | Type | Required | Description | Default Value |
---|---|---|---|---|
cluster_id |
string | True | A unique ID that can be used to reference a Kubernetes cluster. | |
body |
JSON or IO[bytes] | True |
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
req = {
"load_balancers": [
"4de7ac8b-495b-4884-9a69-1050c6793cd6"
],
"volumes": [
"ba49449a-7435-11ea-b89e-0a58ac14480f"
],
"volume_snapshots": [
"edb0478d-7436-11ea-86e6-0a58ac144b91"
]
}
resp = client.kubernetes.destroy_associated_resources_selective(cluster_id="da8fda8", body=req)
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.