kubernetes-the-hard-way/docs/14-cleanup.md

74 lines
1.6 KiB
Markdown
Raw Normal View History

2017-08-29 00:19:25 +03:00
# Cleaning Up
2023-08-01 16:48:20 +03:00
In this lab you will delete the compute resources and optionally the files and configurations created during this tutorial.
2017-08-29 00:19:25 +03:00
## Compute Instances
2017-09-04 00:22:14 +03:00
Delete the controller and worker compute instances:
2017-08-29 00:19:25 +03:00
```
2023-08-01 16:48:20 +03:00
gcloud compute instances delete \
2017-08-29 00:19:25 +03:00
controller-0 controller-1 controller-2 \
2019-09-14 21:41:56 +03:00
worker-0 worker-1 worker-2 \
2023-08-01 16:48:20 +03:00
--quiet
2017-08-29 00:19:25 +03:00
```
## Networking
Delete the external load balancer network resources:
```
2023-08-01 16:48:20 +03:00
gcloud compute forwarding-rules delete kubernetes-forwarding-rule --quiet
2017-08-29 00:19:25 +03:00
2023-08-01 16:48:20 +03:00
gcloud compute target-pools delete kubernetes-target-pool --quiet
2017-08-29 00:19:25 +03:00
2023-08-01 16:48:20 +03:00
gcloud compute http-health-checks delete kubernetes --quiet
2017-08-29 00:19:25 +03:00
2023-08-01 16:48:20 +03:00
gcloud compute addresses delete kubernetes-the-hard-way --quiet
2017-08-29 00:19:25 +03:00
```
Delete the `kubernetes-the-hard-way` firewall rules:
```
2023-08-01 16:48:20 +03:00
gcloud compute firewall-rules delete \
kubernetes-the-hard-way-allow-external \
2023-08-01 16:48:20 +03:00
kubernetes-the-hard-way-allow-health-check \
kubernetes-the-hard-way-allow-internal \
kubernetes-the-hard-way-allow-nginx-service \
--quiet
2017-08-29 00:19:25 +03:00
```
Delete the `kubernetes-the-hard-way` network VPC:
2017-08-29 00:19:25 +03:00
```
2023-08-01 16:48:20 +03:00
gcloud compute routes delete \
kubernetes-route-10-200-0-0-24 \
kubernetes-route-10-200-1-0-24 \
2023-08-01 16:48:20 +03:00
kubernetes-route-10-200-2-0-24 \
--quiet
gcloud compute networks subnets delete kubernetes --quiet
gcloud compute networks delete kubernetes-the-hard-way --quiet
```
## Cleanup The Admin Kubernetes Configuration File
```
kubectl config unset current-context
kubectl config delete-context kubernetes-the-hard-way
2017-08-29 00:19:25 +03:00
2023-08-01 16:48:20 +03:00
kubectl config delete-user admin
2017-08-29 00:19:25 +03:00
2023-08-01 16:48:20 +03:00
kubectl config delete-cluster kubernetes-the-hard-way
2017-08-29 00:19:25 +03:00
```
2021-05-02 08:33:46 +03:00
2023-08-01 16:48:20 +03:00
## Cleanup the Client Tools
2021-05-02 08:33:46 +03:00
```
2023-08-01 16:48:20 +03:00
sudo rm -i /usr/local/bin/cfssl \
/usr/local/bin/cfssljson \
/usr/local/bin/kubectl
2021-05-02 08:33:46 +03:00
```