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. You can get them by using the following 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/ |
+----------------------+----------+---------------------+---------+---------+-------------------------+-----------------------+
- Open Managed Service for Kubernetes in the folder you want to delete the Kubernetes cluster from.
- Click the
icon in the row of the Kubernetes cluster to be deleted. - In the menu that opens, click Delete.
- In the window that opens, click Delete.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
-
Delete the Kubernetes cluster:
yc managed-kubernetes cluster delete test-k8s-cluster
Result:
done
-
Make sure that the Kubernetes cluster was deleted:
yc managed-kubernetes cluster list
Result:
+----+------+------------+--------+--------+-------------------+-------------------+ | ID | NAME | CREATED AT | HEALTH | STATUS | EXTERNAL ENDPOINT | INTERNAL ENDPOINT | +----+------+------------+--------+--------+-------------------+-------------------+ +----+------+------------+--------+--------+-------------------+-------------------+
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
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 destroy
Alert
Terraform will delete all the resources you created using it, such as clusters, networks, subnets, and VMs.
-
Type
yes
and press Enter.