Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete VPC resources #103

Closed
errordeveloper opened this issue Jul 9, 2018 · 20 comments · Fixed by #1010
Closed

delete VPC resources #103

errordeveloper opened this issue Jul 9, 2018 · 20 comments · Fixed by #1010
Assignees
Labels
area/aws-vpc area/deletions help wanted Extra attention is needed kind/feature New feature or request
Milestone

Comments

@errordeveloper
Copy link
Contributor

Currently deleting VPC stack will fail when there resources such as ELBs. We should be able to delete these, the questions is whether we should do it by default when we own the VPC or not?

@errordeveloper errordeveloper added kind/feature New feature or request p1 labels Jul 9, 2018
@errordeveloper errordeveloper changed the title deletion for VPC resources delete VPC resources Jul 9, 2018
@JordanFaust
Copy link

Defaulting to this sounds dangerous when some consumers may be leveraging pre-existing VPC's

@errordeveloper
Copy link
Contributor Author

@JordanFaust indeed, full cleanup would be only done in the cases where VPC was created by us. Also, this is really a broad issue at this point – so for example deleting all cluster resource before delete the cluster itself could be sufficient in many cases.

@jstrachan
Copy link
Contributor

maybe prompt the user or have a --all CLI option to delete everything?

Its currently a huge PITA deleting clusters as usually there's something (usually a Load Balancer! sometimes other things...) causing the VPC to not get deleted resulting in lots of fun with the AWS console

@errordeveloper
Copy link
Contributor Author

errordeveloper commented Jul 23, 2018 via email

@errordeveloper errordeveloper added this to the 0.1.x – improvements milestone Jul 23, 2018
@richardcase richardcase removed the p1 label Aug 16, 2018
@paulbsch
Copy link
Contributor

This is of interest to me as I'm working with an app that creates k8s LoadBalancer services on demand. So at the moment, it's not possible for me to cleanly delete the clusters I create with eksctl. I think it makes sense for 'delete cluster' to automatically clean up the ELBs that were created with the eksctl created VPC.

@errordeveloper
Copy link
Contributor Author

errordeveloper commented Sep 17, 2018 via email

@paulbsch
Copy link
Contributor

paulbsch commented Sep 17, 2018

I have been deleting the ELBs. The VPC delete then gets hung up on the related security groups. So it seems to require deleting those manually also. But yes. It is a bit painful as I'm trying to automate as much as possible.

@errordeveloper
Copy link
Contributor Author

errordeveloper commented Sep 17, 2018 via email

@paulbsch
Copy link
Contributor

I have done that. The GC hasn't kicked in as I have seen. At least it didn't do so in a short enough time frame.

@errordeveloper
Copy link
Contributor Author

@falfaro
Copy link

falfaro commented Feb 19, 2019

Any progress on this? Specifically on the ELB part?

@errordeveloper
Copy link
Contributor Author

errordeveloper commented Feb 19, 2019 via email

@eladh
Copy link

eladh commented Apr 22, 2019

Hi @errordeveloper - is there any update ? 10x

@mplaul
Copy link

mplaul commented Jun 6, 2019

Hey @errordeveloper, any news on this issue?

@errordeveloper
Copy link
Contributor Author

errordeveloper commented Jul 5, 2019

I did a simple test, and it looks ELBs certainly get deleted right away when a service is downgraded to type: ClusterIP (which is not always trivial, for example, I had to also clear nodePort).

$ kubectl describe service test
...
Events:
  Type    Reason                Age   From                Message
  ----    ------                ----  ----                -------
  Normal  EnsuringLoadBalancer  10m   service-controller  Ensuring load balancer
  Normal  EnsuredLoadBalancer   10m   service-controller  Ensured load balancer
  Normal  Type                  25s   service-controller  LoadBalancer -> ClusterIP
  Normal  DeletingLoadBalancer  25s   service-controller  Deleting load balancer
  Normal  DeletedLoadBalancer   14s   service-controller  Deleted load balancer
$ aws elb describe-load-balancers --region=us-west-2  --load-balancer-names=a06ca65f69f2c11e9abda02adb46d809 

An error occurred (LoadBalancerNotFound) when calling the DescribeLoadBalancers operation: There is no ACTIVE Load Balancer named 'a06ca65f69f2c11e9abda02adb46d809'
$

Deleting the service also appears to delete ELB right away:

$ kubectl get svc -n weave         weave-scope-app                                                      
NAME              TYPE           CLUSTER-IP     EXTERNAL-IP                                                              PORT(S)        AGE
weave-scope-app   LoadBalancer   10.100.37.77   af625d6939f2b11e9abda02adb46d809-464598359.us-west-2.elb.amazonaws.com   80:30551/TCP   16m
$ curl af625d6939f2b11e9abda02adb46d809-464598359.us-west-2.elb.amazonaws.com       
<!doctype html>
<html class="no-js">
  <head>
    <meta charset="utf-8">
    <title>Weave Scope</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script language="javascript">window.__WEAVEWORKS_CSRF_TOKEN = "$__CSRF_TOKEN_PLACEHOLDER__";</script>
  </head>
  <body>
    <!--[if lt IE 10]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->
    <div class="wrap">
      <div id="app"></div>
    </div>
  <script type="text/javascript" src="app-69f341e7438c0844544f.js?754df3ea8a568a4a1ee5"></script><script type="text/javascript" src="vendors-0e09fc049edd1048be73.js?754df3ea8a568a4a1ee5"></script></body>
</html>
 [0] >> aws elb describe-load-balancers --region=us-west-2  --load-balancer-names=af625d6939f2b11e9abda02adb46d809 
{ ... }
$ kubectl delete svc -n weave weave-scope-app                                              
service "weave-scope-app" deleted
$ aws elb describe-load-balancers --region=us-west-2 --load-balancer-names=af625d6939f2b11e9abda02adb46d809 

An error occurred (LoadBalancerNotFound) when calling the DescribeLoadBalancers operation: There is no ACTIVE Load Balancer named 'af625d6939f2b11e9abda02adb46d809'
$ 

I do recall this didn't work as simply before, perhaps it's something that got fix recently. I used 1.13 for my test cluster, this issue was open when 1.10 was the only version EKS shipped and @paulbsch comments probably relates to 1.10 also. Perhaps we should try with 1.10, 1.11 and 1.12, and see where it's been solved. In any case, we should attempt deleting service before deleting clusters.

Even if user didn't delete their workloads and services before deleting a cluster, we should provide them with clean deletion path.

@2opremio
Copy link
Contributor

2opremio commented Jul 5, 2019 via email

@2opremio 2opremio self-assigned this Jul 5, 2019
@2opremio
Copy link
Contributor

2opremio commented Jul 8, 2019

@rusyasoft
Copy link

rusyasoft commented Jul 23, 2020

I have created a cluster with new VPC (following to https://eksctl.io/usage/creating-and-managing-clusters/)
After successful creation I have run eksctl delete cluster -f cluster.yaml

So far everything deleted including VPC it created (even though it reflects not right-away), is it normal behavior? I'm just hoping when I apply eksctl to my production environment with my existing VPC, it won't wipe out my existing VPC.

Is there any place where I can look-up for best practices integrating eksctl to a an existing production environment step-by-step ?

@michaelbeaumont
Copy link
Contributor

@rusyasoft It only deletes VPCs that it created.

@okossuth
Copy link

torredil pushed a commit to torredil/eksctl that referenced this issue May 20, 2022
Update sample manifest files to use alpha image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/aws-vpc area/deletions help wanted Extra attention is needed kind/feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.