Skip to content

Delete a Cluster

DELETE /api/v1/tenants/{tenant}/clusters/{name}
Terminal window
export KUPE_TENANT="<tenant>"
export KUPE_CLUSTER="staging"
curl -X DELETE \
-H "Authorization: Bearer $KUPE_API_KEY" \
"https://api.kupe.cloud/api/v1/tenants/$KUPE_TENANT/clusters/$KUPE_CLUSTER"

Returns 204 No Content on success. The cluster enters a Deleting phase and is fully removed asynchronously by the platform operator.

See Reference: delete cluster for the full schema.

If you need to know when the cluster has been fully removed (for example, before reusing the same name), poll the GET endpoint until it returns 404 Not Found:

Terminal window
export KUPE_TENANT="<tenant>"
export KUPE_CLUSTER="staging"
TIMEOUT_SECONDS=300
INTERVAL=5
ELAPSED=0
while [ "$ELAPSED" -lt "$TIMEOUT_SECONDS" ]; do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $KUPE_API_KEY" \
"https://api.kupe.cloud/api/v1/tenants/$KUPE_TENANT/clusters/$KUPE_CLUSTER")
if [ "$STATUS" = "404" ]; then
echo "Cluster deleted"
exit 0
fi
echo "Still deleting (HTTP $STATUS, elapsed ${ELAPSED}s)"
sleep "$INTERVAL"
ELAPSED=$((ELAPSED + INTERVAL))
done
echo "Timed out waiting for delete after ${TIMEOUT_SECONDS}s" >&2
exit 1

Only members with the admin role can delete clusters. A 403 Forbidden is returned for readonly keys or members.