Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to delete load balancer using gcloud command?

Deleting load balancer from console is easy. Just click on delete icon and wait for the load balancer to disappear.

Is there similar gcloud command to delete load balancer (cascade delete all related frontend, backend, url-map, health check etc. )?

GCP Documents explain how to setup various load balancers but none of them cover how to clean up

like image 718
Prashant Bhate Avatar asked Feb 22 '18 15:02

Prashant Bhate


People also ask

How do I delete a load balancer?

To delete a load balancer using the consoleOn the navigation pane, under LOAD BALANCING, choose Load Balancers. Select the load balancer, and then choose Actions, Delete.

How do I delete a load balancer in Kubernetes?

In the Networking section of the control panel, select Load Balancers. Open the load balancer's More menu, select Edit settings, click Destroy, and confirm.

How do I uninstall classic load balancer?

To delete your load balancerOn the navigation pane, under Load Balancing, choose Load Balancers. Select the load balancer. Choose Actions, Delete.


2 Answers

There is no single gcloud command to wipe out a loadbalancer. You'll need to delete its constituent parts, one at a time.

These parts are:

Backend
gcloud compute backend-services delete [BACKEND_SERVICE]
Target Proxy
gcloud compute target-${PROTOCOL}-proxies delete [TARGET_PROXY]
Forwarding Rules (Frontend)
gcloud compute forwarding-rules delete [FORWARDING_RULE]
Static IP addresses
gcloud compute addresses delete [IP_ADDRESS]
Health Checks
gcloud compute health-checks delete [HEALTH_CHECK]
URL Maps
gcloud compute url-maps delete [URL_MAP]

Depending on your needs, you may or may not want to actually delete your static IPs and health checks, or even have any URL maps to delete.

like image 128
Eric Dand Avatar answered Sep 20 '22 02:09

Eric Dand


This may be helpful to delete orphaned resources:

https://github.com/pantheon-systems/kube-gce-cleanup

like image 41
James Avatar answered Sep 18 '22 02:09

James