kubernetes: GKE network load balancer doesn't get deleted on service deletion

FEATURE REQUEST

When deleting a service of type LoadBalancer I would expect the GCE network load balancer to get deleted as well.

Kubernetes version

Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.6", GitCommit:"e569a27d02001e343cb68086bc06d47804f62af6", GitTreeState:"clean", BuildDate:"2016-11-12T05:22:15Z", GoVersion:"go1.6.3
", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.7", GitCommit:"92b4f971662de9d8770f8dcd2ee01ec226a6f6c0", GitTreeState:"clean", BuildDate:"2016-12-10T04:43:42Z", GoVersion:"go1.6.3
", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • GKE 1.4.7:
  • gci image

What happened: Deleting a service of type LoadBalancer leaves the network load balancer in place leading to unnecessary costs.

What you expected to happen: That the network load balancer gets removed as well.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 40 (21 by maintainers)

Most upvoted comments

@roberthbailey @k4leung4 My cluster has 3 load-balancer services I used GKE API DeleteCluster function to delete the cluster. After the cluster gets deleted, a few instances of the following things still remain

  • In-use IP addresses global
  • Forwarding Rules
  • Target Pools
  • Health Checks
  • Firewall Rules

And on creating & deleting the cluster repeatedly, the number of used instances of these resources kept on piling up. This is a problem in automating cluster creation and deletion as the resources-quota is reached even when the resource is not being used.

I think we also just saw this. We’re running on GKE with kubernetes 1.7.8 and we run out of IP addresses. https://pantheon.corp.google.com/net-services/loadbalancing/loadBalancers/list shows that all IPs are used by load-balancers. If I run the script below

PROJECT=${1:-$(gcloud 2>/dev/null config get-value project)}
REGION=$(gcloud 2>/dev/null config  get-value compute/region)

LIST=$(gcloud --project="${PROJECT}" compute forwarding-rules list --format='value(name)')

for x in ${LIST}; do
  description=$(gcloud compute --project="${PROJECT}" forwarding-rules describe "${x}" --region="${REGION}")
  service=$(echo "$description" | grep "^description:" | cut -d\' -f2 | jq -r '."kubernetes.io/service-name"')
  timestamp=$(echo "$description" | grep "^creationTimestamp:" | cut -d':' -f2-)

  echo "${x} ${timestamp} ${service}"
done

I get 8 lines for the same service.