DeleteCluster

更新时间:
复制 MD 格式

When you no longer need a cluster, you can delete it and choose whether to delete or retain its associated resources. Before deleting a cluster, you must manually remove its workloads, such as stateless applications, stateful applications, jobs, and cronjobs. Otherwise, the deletion might fail.

Operation description

Important

  • Subscription-based resources, such as ECS instances and Lingjun computing nodes, are not automatically released. You must manually release them to avoid unnecessary charges. For more details, see Cluster deletion and node release rules.

  • Subscription-based APIServer SLB resources are not automatically released. You must manually release them to avoid unnecessary charges.

  • If resources such as VPCs, VSwitches, security groups, and RAM roles are in use by other resources, they are retained by default. You must release them manually.

  • ECIs created with virtual nodes are automatically released.

  • Some cloud resources created with the cluster are not automatically released when you delete the cluster and continue to incur charges. You can choose to retain or release them. These resources include SLS projects automatically created by the cluster and cloud disks purchased via 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

Whether to retain all associated resources. If you set this parameter to true, the retain_resources parameter is ignored, and all cloud resources that are created with the cluster and can be queried by calling DescribeClusterResources are retained. If you set this parameter to false, note that resources that are configured to be retained by default in the delete_options parameter are still retained. To delete these resources, you must explicitly set the delete_mode parameter to delete for them in delete_options.

  • true: Retains all associated cloud resources that are created with the cluster.

  • false: Does not retain all associated cloud resources. Resources that are configured to be retained by default in the delete_options parameter, such as ALB, are still retained when this parameter is set to false.

Default value: false.

false

keep_slb deprecated

boolean

No

Whether to retain SLB resources. Valid values:

  • true: Retains the SLB resources that are created for the cluster.

  • false: Does not retain the SLB resources that are created for the cluster.

Default value: false. Use the delete_options parameter to manage SLB resources instead.

false

retain_resources

array

No

The IDs of resources to retain when the cluster is deleted.

string

No

The resource ID.

sg-2ze6ess9kho6fdn9****

delete_options

array<object>

No

The options for deleting the resources that are associated with the cluster.

object

No

The deletion options for a specific type of resource.

resource_type

string

No

The type of resource. Valid values:

  • SLB: the SLB resources created for Services. These resources are deleted by default, but you can choose to retain them.

  • ALB: the ALB resources created by the ALB Ingress controller. These resources are retained by default, but you can choose to delete them.

  • SLS_Data: the SLS project used for cluster logs. This resource is retained by default, but you can choose to delete it.

  • SLS_ControlPlane: the SLS project used for control plane logs in a managed cluster. This resource is retained by default, but you can choose to delete it.

  • PrivateZone: the PrivateZone resource created by an ACK Serverless cluster. This resource is retained by default, but you can choose to delete it.

SLS_Data

delete_mode

string

No

The deletion policy for the specified resource type. Valid values:

  • delete: Deletes the resources.

  • retain: Retains the resources.

delete

Response elements

Element

Type

Description

Example

object

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.