[Yandex Cloud documentation](../../../index.md) > [Yandex Managed Service for Kubernetes](../../index.md) > [Step-by-step guides](../index.md) > Managing a Kubernetes cluster > Deleting a Kubernetes cluster

# Deleting a Kubernetes cluster

{% note alert %}

When deleting a Managed Service for Kubernetes cluster, Compute Cloud disks attached to `PersistentVolumes` are not deleted automatically.

{% endnote %}

To access a Kubernetes cluster, use its name or unique ID that you can get by using this command:

```bash
yc managed-kubernetes cluster list
```

Result:

```bash
+----------------------+----------+---------------------+---------+---------+-------------------------+-----------------------+
|          ID          |   NAME   |     CREATED AT      | HEALTH  | STATUS  |    EXTERNAL ENDPOINT    |   INTERNAL ENDPOINT   |
+----------------------+----------+---------------------+---------+---------+-------------------------+-----------------------+
| cati493bu7ia******** | k8s-demo | 2019-11-20 11:26:36 | HEALTHY | RUNNING | https://84.201.174.147/ | https://192.168.0.27/ |
+----------------------+----------+---------------------+---------+---------+-------------------------+-----------------------+
```

{% list tabs group=instructions %}

- Management console {#console}

  1. Open **Managed Service for&nbsp;Kubernetes** in the [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) where you want to delete a [Kubernetes cluster](../../concepts/index.md#kubernetes-cluster).
  1. Click ![image](../../../_assets/console-icons/ellipsis.svg) in the row of the Kubernetes cluster you need to delete.
  1. In the menu that opens, click **Delete**.
  1. In the window that opens, click **Delete**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  1. Delete the Kubernetes cluster:

     ```bash
     yc managed-kubernetes cluster delete test-k8s-cluster
     ```

     Result:

     ```text
     done
     ```

  1. Make sure the Kubernetes cluster was deleted:

     ```bash
     yc managed-kubernetes cluster list
     ```

     Result:

     ```text
     +----+------+------------+--------+--------+-------------------+-------------------+
     | ID | NAME | CREATED AT | HEALTH | STATUS | EXTERNAL ENDPOINT | INTERNAL ENDPOINT |
     +----+------+------------+--------+--------+-------------------+-------------------+
     +----+------+------------+--------+--------+-------------------+-------------------+
     ```

- Terraform {#tf}

  With [Terraform](https://www.terraform.io/), you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
  
  Terraform is distributed under the [Business Source License](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
  
  For more information about the provider resources, see the guides on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../../terraform/index.md).
  
  
  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.
  
  
  To delete a cluster created using Terraform:
  1. In the command line, go to the folder that houses the current Terraform configuration file with an infrastructure plan.
  1. Delete the resources using this command:
  
     ```bash
     terraform destroy
     ```
  
     {% note alert %}
  
     Terraform will delete all the resources you created using it, such as clusters, networks, subnets, and VMs.
  
     {% endnote %}
  
  1. Type `yes` and press **Enter**.

- API {#api}

  To delete a Kubernetes cluster, use the [delete](../../managed-kubernetes/api-ref/Cluster/delete.md) REST API method for the [Cluster](../../managed-kubernetes/api-ref/Cluster/index.md) resource or the [ClusterService/Delete](../../managed-kubernetes/api-ref/grpc/Cluster/delete.md) gRPC API call.

{% endlist %}