Deleting a Kubernetes cluster
Alert
When deleting a Managed Service for Kubernetes cluster, Compute Cloud disks attached to PersistentVolumes are not deleted automatically.
To access a Kubernetes cluster, use its name or unique ID that you can get by using this command:
yc managed-kubernetes cluster list
Result:
+----------------------+----------+---------------------+---------+---------+-------------------------+-----------------------+
| 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/ |
+----------------------+----------+---------------------+---------+---------+-------------------------+-----------------------+
- In the folder where you want to delete a Managed Service for Kubernetes cluster, open the Managed Service for Kubernetes section.
- Click
in the row with the Managed Service for Kubernetes cluster to delete and select Delete. - In the window that opens, confirm the cluster deletion.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
-
Delete the Kubernetes cluster:
yc managed-kubernetes cluster delete test-k8s-clusterResult:
done -
Make sure the Kubernetes cluster was deleted:
yc managed-kubernetes cluster listResult:
+----+------+------------+--------+--------+-------------------+-------------------+ | ID | NAME | CREATED AT | HEALTH | STATUS | EXTERNAL ENDPOINT | INTERNAL ENDPOINT | +----+------+------------+--------+--------+-------------------+-------------------+ +----+------+------------+--------+--------+-------------------+-------------------+
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the guides on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.
To delete a cluster created using Terraform:
-
In the command line, go to the folder that houses the current Terraform configuration file with an infrastructure plan.
-
Delete the resources using this command:
terraform destroyAlert
Terraform will delete all the resources you created using it, such as clusters, networks, subnets, and VMs.
-
Type
yesand press Enter.
To delete a Kubernetes cluster, use the delete REST API method for the Cluster resource or the ClusterService/Delete gRPC API call.