|
| 1 | +# 11. Cleanup |
| 2 | + |
| 3 | +Estimated time: 4 min remaining |
| 4 | + |
| 5 | +Time for some cleaning of the resources used (to save on cost and to be a good cloud citizen). |
| 6 | + |
| 7 | +To delete the dervice, we need to get the service name first: |
| 8 | +```sh |
| 9 | +$ kubectl get service |
| 10 | +NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 11 | +hello-node-2142604176-x8 10.124.132.1 123.132.123.151 8080/TCP 1h |
| 12 | +``` |
| 13 | +Then we can delete the service, which also deletes your external load balancer: |
| 14 | +```sh |
| 15 | +kubectl delete services hello-node-2142604176-x8 |
| 16 | +service "hello-node-2142604176-x8" deleted |
| 17 | +``` |
| 18 | + |
| 19 | +Delete the running pods: |
| 20 | +```sh |
| 21 | +$ kubectl delete rc hello-node |
| 22 | +``` |
| 23 | +Delete your cluster: |
| 24 | +```sh |
| 25 | +$ gcloud container clusters delete hello-world |
| 26 | + Waiting for cluster deletion...done. |
| 27 | + name: operation-xxxxxxxxxxxxxxxx |
| 28 | + operationType: deleteCluster |
| 29 | + status: done |
| 30 | + target: /projects/kubernetes-codelab/zones/us-central1-f/clusters/hello-world |
| 31 | + zone: us-central1-f |
| 32 | +``` |
| 33 | +This deletes the Google Compute Engine instances that are running the cluster. |
| 34 | + |
| 35 | +Finally delete the Docker registry storage bucket hosting your image(s): |
| 36 | +```sh |
| 37 | +$ gsutil ls |
| 38 | +gs://artifacts.<PROJECT_ID>.appspot.com/ |
| 39 | +$ gsutil rm -r gs://artifacts.<PROJECT_ID>.appspot.com/ |
| 40 | +Removing gs://artifacts.<PROJECT_ID>.appspot.com/... |
| 41 | +``` |
| 42 | +Of course, you can also delete the entire project but note that you must first disable billing on the project. |
| 43 | +Additionally, deleting a project will only happen after the current billing cycle ends. |
| 44 | + |
| 45 | +#### [Go to step 12](step12.md) |
| 46 | +#### [Go back to step 10](step10.md) |
0 commit comments