DeleteCluster

Updated at:

Deletes a cluster and specifies whether to delete or retain the associated resources of the cluster. Before you delete a cluster, manually clean up workloads such as Deployments, StatefulSets, Jobs, and CronJobs. Otherwise, the cluster deletion may fail.

Operation description

Risk warnings:

  • Subscription ECS instances and Lingjun computing nodes in the cluster do not support automatic release. To avoid unnecessary fees, perform a manual release. For more information, see Cluster deletion and node release rules.

  • Subscription APIServer SLB resources do not support automatic release. To avoid unnecessary fees, perform a manual release.

  • VPCs, vSwitches, security groups, and RAM roles are retained by default if they are used by other resources and cannot be deleted. Perform a manual release.

  • Elastic Container Instance (ECI) pods created by using virtual nodes undergo automatic release.

  • Some cloud resources created by the cluster do not undergo automatic release when the cluster is deleted, and billing continues after the cluster is deleted. Release or retain these resources based on your actual needs. These resources include Simple Log Service projects created through automatic creation by the cluster and cloud disks purchased by using dynamic volumes.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cs:DeleteCluster

delete

*Cluster

acs:cs:{#regionId}:{#accountId}:cluster/{#ClusterId}

None None

Request syntax

DELETE /clusters/{ClusterId} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

ClusterId

string

Yes

The cluster ID.

c905d1364c2dd4b6284a3f41790c4****

Request parameters

Parameter

Type

Required

Description

Example

retain_all_resources

boolean

No

Specifies whether to retain all resources. If you set this parameter to true, the retain_resources parameter is ignored, and the cloud resources created by the cluster that are queried by calling the DescribeClusterResources operation are retained. If you set this parameter to false, note that the resources that are retained by default in delete_options are still retained. To delete these resources, set delete_mode to delete in delete_options.

Valid values:

  • true: Retains all resources, including all cloud resources created by the cluster.

  • false: Does not retain all resources, except for the resources that are retained by default in delete_options. For example, ALB resources are still retained even if this parameter is set to false.

Default value: false.

false

keep_slb deprecated

boolean

No

Specifies whether to retain the SLB instances. Valid values:

  • true: Retains the created SLB resources.

  • false: Does not retain the created SLB resources.

Default value: false. [Deprecated] Use SLB in delete_options instead.

false

retain_resources

array

No

The list of resources. To retain resources when you delete the cluster, specify the IDs of the resources.

string

No

The resource ID.

sg-2ze6ess9kho6fdn9****

delete_options

array<object>

No

The deletion options for the resources associated with the cluster.

object

No

The deletion options for resources of a specific type.

resource_type

string

No

The resource type. Valid values:

  • SLB: The SLB resources created by using Services. By default, these resources are deleted. You can choose to retain them.

  • ALB: The ALB resources created by ALB Ingress Controller. By default, these resources are retained. You can choose to delete them.

  • SLS_Data: The Simple Log Service project used for the cluster log feature. By default, this resource is retained. You can choose to delete it.

  • SLS_ControlPlane: The Simple Log Service project used for the control plane logs of managed clusters. By default, this resource is retained. You can choose to delete it.

  • PrivateZone: The PrivateZone resources created by ACK Serverless clusters. By default, these resources are retained. You can choose to delete them.

SLS_Data

delete_mode

string

No

The deletion mode for the resource type. Valid values:

  • delete: Deletes the resources of this type.

  • retain: Retains the resources of this type.

delete

Response elements

Element

Type

Description

Example

object

The response body.

cluster_id

string

The cluster ID.

cb95aa626a47740afbf6aa099b650****

request_id

string

The request ID.

687C5BAA-D103-4993-884B-C35E4314****

task_id

string

The task ID.

T-5a54309c80282e39ea****

Examples

Success response

JSON format

{
  "cluster_id": "cb95aa626a47740afbf6aa099b650****",
  "request_id": "687C5BAA-D103-4993-884B-C35E4314****",
  "task_id": "T-5a54309c80282e39ea****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.