简体   繁体   中英

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?

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

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

您可以使用配置文件执行相同的过程,看看是否与命令或配置相关吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM