删除集群

本部分将删除该教程所创建的全部计算资源。

计算节点

删除所有的控制节点和 worker 节点:

  1. gcloud -q compute instances delete \
  2. controller-0 controller-1 controller-2 \
  3. worker-0 worker-1 worker-2

网路

删除外部负载均衡器以及网络资源:

  1. gcloud -q compute forwarding-rules delete kubernetes-forwarding-rule \
  2. --region $(gcloud config get-value compute/region)
  3. gcloud -q compute target-pools delete kubernetes-target-pool
  4. gcloud -q compute http-health-checks delete kubernetes
  5. gcloud -q compute addresses delete kubernetes-the-hard-way

删除 kubernetes-the-hard-way 防火墙规则:

  1. gcloud -q compute firewall-rules delete \
  2. kubernetes-the-hard-way-allow-nginx-service \
  3. kubernetes-the-hard-way-allow-internal \
  4. kubernetes-the-hard-way-allow-external \
  5. kubernetes-the-hard-way-allow-health-check

删除 Pod 网络路由:

  1. gcloud -q compute routes delete \
  2. kubernetes-route-10-200-0-0-24 \
  3. kubernetes-route-10-200-1-0-24 \
  4. kubernetes-route-10-200-2-0-24

删除 kubernetes 子网:

  1. gcloud -q compute networks subnets delete kubernetes

删除 kubernetes-the-hard-way 网络 VPC:

  1. gcloud -q compute networks delete kubernetes-the-hard-way