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
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.
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.
To delete your load balancerOn the navigation pane, under Load Balancing, choose Load Balancers. Select the load balancer. Choose Actions, Delete.
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:
Backendgcloud 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.
This may be helpful to delete orphaned resources:
https://github.com/pantheon-systems/kube-gce-cleanup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With