How Do You Delete VM Instances from GCP That Pertain to GKE?

Problem Scenario
You have some GKE standard clusters that you want deleted with Cloud Shell and not the web UI.  What should you do?

Solution
1.  Delete the instance group of the instance for the cluster you want to delete.  To do this in the web UI, go to Compute Engine -> Instance Groups.  Check the box on the left-hand side and click on "Delete".
2.  Go to the ">_" icon in the upper right-hand corner.  When you hover over it, it should say "Activate Cloud Shell".  Click on it.
3.  Run this command (but replace "gke-standard-cluster-1-default-pool-abcd1234-56ef" with the name of the instance and replace "us-central1-a" with its regional name):

gcloud compute instances delete gke-standard-cluster-1-default-pool-abcd1234-56ef --zone us-central1-a

4.  Respond with a "Y" to the next prompt.

Leave a comment

Your email address will not be published. Required fields are marked *