Delete GKE Service, Deployment and Cluster | Scribe

Delete GKE Service, Deployment and Cluster

  • Hafeez Baig |
  • 19 steps |
  • 2 minutes
  • Google CloudGoogle Cloud
alert ordinal icon
Please review the previous lab on Services in Kubernetes before proceeding with this lab.<https://scribehow.com/shared/Understanding_Services_in_Kubernetes__wGBJjbLXTkmEelnYxSvpYw>
1
To delete a service in **Cloud Shell CLI**, type the command "**kubectl delete service hello-world-rest-api**"
information ordinal icon
**What is [[kubectl delete service hello-world-rest-api]]?**\ \ The `kubectl delete service hello-world-rest-api` the command deletes the specified service (`hello-world-rest-api`) from your Kubernetes cluster.
2
service "**kubectl delete service hello-world-rest-api**" deleted is displayed
3
To delete a deployment in **Cloud Shell CLI**, type the command [[kubectl delete deployment hello-world-rest-api]]
information ordinal icon
**What is the [[kubectl delete deployment hello-world-rest-api ]]command?**\ \ The `kubectl delete deployment hello-world-rest-api` the command deletes the specified deployment (`hello-world-rest-api`) from your Kubernetes cluster, along with all the pods managed by that deployment.
4
**deployment.apps "hello-world-rest-api" deleted** is displayed
5
Go back to the **hello-world-rest-api** tab
6
Click on the **My Kubernetes Project** dropdown on the left side
7
Select a project wizard will open, copy the **ID** of the Name **My Kubernetes Project**
8
To set the project in **Cloud Shell CLI**, type the command [[gcloud config set project &lt;paste the project ID&gt;]]
9
**Updated property \[core/project\]** is displayed
10
To delete the cluster, type the command [[gcloud container clusters delete my-cluster --zone us-central1-c]] **Note:** Make sure you are entering the correct zone and region where your cluster is created.
information ordinal icon
**What is** [[gcloud container clusters delete my-cluster --zone us-central1-c]]**command?**\ \ The `gcloud container clusters delete my-cluster --zone us-central1-c` the command deletes the specified Kubernetes cluster (`my-cluster`) in the Google Cloud zone `us-central1-c`.
11
Type "**Y**" to continue the process of deletion
12
Deleting cluster my-cluster is in process **Note:** The deletion of the cluster will take sometime.
13
Go back to the **hello-world-rest-api** tab
14
On the top right corner click on the three dots widget
15
Click on the **Project settings** option from the dropdown
16
**Settings** wizard will open, check your project Name and Project ID