Prashant Bhate
Prashant Bhate

Reputation: 11087

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

Upvotes: 8

Views: 9594

Answers (2)

James
James

Reputation: 510

This may be helpful to delete orphaned resources:

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

Upvotes: 1

Eric Dand
Eric Dand

Reputation: 1210

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.

Upvotes: 21

Related Questions