jeffreyveon
jeffreyveon

Reputation: 13830

Kubernetes/AWS - ELB is not deleted when the service is deleted

I'm using the --cloud-provider=aws flag to integrate Kubernetes with AWS. I'm able to create and expose a service via ELB using the following commands:

kubectl run sample-nginx --image=docker.io/nginx --port=80

kubectl expose deployment/sample-nginx --port=80 --target-port=80 \
--name=sample-nginx-service --type=LoadBalancer && \
kubectl annotate svc sample-nginx-service \
service.beta.kubernetes.io/aws-load-balancer-internal=0.0.0.0/0

This exposes the nginx service on an internal-ELB on a private subnet. I'm able to access the service on the ELB as well.

Now, when I delete the service, the service is deleted, but the ELB is not. Here's how I deleted the service:

kubectl delete services sample-nginx-service

Any pointers to what could be going wrong? I did not see any errors in the kube-controller-manager log when I ran the deletion command. What other logs should I be checking?

Upvotes: 0

Views: 2541

Answers (3)

jeffreyveon
jeffreyveon

Reputation: 13830

Upgrading to etcd v3.0.17 from v3.0.10 fixed the issue. I found another log messaged in the controller logs which pointed to the issue here:

https://github.com/kubernetes/kubernetes/issues/41760

Upvotes: 1

jonas kint
jonas kint

Reputation: 41

Can you do the same process but with a config file and see if it's command or config related?

Upvotes: 0

dkeitel
dkeitel

Reputation: 1

You seem to have a typo on your service delete command.

It should be kubectl delete services sample-nginx-service.

I just tried this on my AWS cluster and confirmed that the ELB was deleted successfully after running this.

I'm running Kubernetes 1.6.2 with kubectl 1.6.3

Upvotes: 0

Related Questions