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

Unable to re-create a cluster with the same Name, after deleting it from AWS Console #2014

Closed
bartcant opened this issue Apr 7, 2020 · 9 comments
Labels
kind/help Request for help

Comments

@bartcant
Copy link

bartcant commented Apr 7, 2020

I am trying to re-create a cluster with the same name I previously created (via eksctl) and deleted by using the AWS Console.

I believe it is related to Issue #1386
#1386

I added my comments and logs in the comments section

#1386 (comment)

@bartcant bartcant added the kind/help Request for help label Apr 7, 2020
@bartcant
Copy link
Author

bartcant commented Apr 8, 2020

AWS Support provided work around:

Deletion:
ii) Deletion of Eks cluster from web console is successful.If you delete the cluster using webconsole it will not delete the backend stack(eksctl-damltest1-cluster).In our case Eks cluster got successfully deleted but backend CloudFormation stack(eksctl-damltest1-cluster) still exists.

Recreation:
iii) While creating Eks cluster with same name using Eks tool you may see the following error , The error is due to CloudFormation stack exists with name eksctl-damltest1-cluster from the initial creation.

"creating CloudFormation stack "eksctl-damltest1-cluster": AlreadyExistsException: Stack [eksctl-damltest1-cluster] already exists status code: 400"

===================================================================================================================================

I would request you to delete CloudFormation stack eksctl-damltest1-cluster from web console[1] and then create Eks cluster with same name("damltest1"). As of now i see Stack deletion got failed because of VPC, Subnet , Internet gateway dependency error. Since the state of the Stack in DELETE_FAILED state , you can delete the stack from console and skip the resources that are having dependency. Skipping the resources will delete the Stack completely and allow you to create new Eks cluster with same name using Eksctl tool.

As a second way of work around you can create the EKs cluster with same name using Web console.As you may know we can create Eks cluster using web console please refer to the link[2].As best practice managing the EKS cluster using "eksctl" tool will be preferred to create a cluster. This way the deletion will also trigger a deletion to the CloudFromation stack launched during the creation. However as stack failures can happen, it is best to confirm cfn stacks have been deleted from the console/awscli as well.

If you have any other queries or come across any issues, please let us know. For direct assistance and troubleshooting, please initiate a phone call or chat.

Refernces:
[1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-delete-stack.html
[2] https://docs.aws.amazon.com/eks/latest/userguide/getting-started-console.html
[3] https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html

@bartcant bartcant closed this as completed Apr 8, 2020
@bartcant bartcant changed the title Unable to rec-create a cluster with the same Name, after deleting it from AWS Console Unable to re-create a cluster with the same Name, after deleting it from AWS Console Apr 17, 2020
@ghost
Copy link

ghost commented Jun 4, 2020

Was also getting the error:
[✖] creating CloudFormation stack "eksctl-xxx-cluster": AlreadyExistsException: Stack [eksctl-xxx-cluster] already exists
status code: 400, request id: 93fb0c2e-039b-44d2-xxx-xxxxxxxxx
eksctl create ... worked again when I deleted the relevant CloudFormation stack on AWS.

@termlen0
Copy link

Shouldn't this be an open issue? Isn't the solution provided above a workaround?

@michaelbeaumont
Copy link
Contributor

@termlen0 The solution is just to delete the eksctl stack(s) from the AWS console, not only the EKS cluster.
eksctl won't delete the stack(s) in general because it's useful to have to the stack to debug issues and even if it tried, in some cases the stack might still end up in DELETE_FAILED.

@montanaflynn
Copy link

This is clearly a bug:

I created a cluster and deleted it from eksctl version 0.58.0. It said it was all deleted:

2021-07-29 15:30:27 [ℹ]  will delete stack "eksctl-production-singapore-cluster"
2021-07-29 15:30:27 [✔]  all cluster resources were deleted

Then I tried to create it again and got an error:

2021-07-30 09:08:26 [ℹ]  building cluster stack "eksctl-production-singapore-cluster"
2021-07-30 09:08:27 [!]  1 error(s) occurred and cluster hasn't been created properly, you may wish to check CloudFormation console
2021-07-30 09:08:27 [ℹ]  to cleanup resources, run 'eksctl delete cluster --region=ap-southeast-1 --name=production-singapore'
2021-07-30 09:08:27 [✖]  creating CloudFormation stack "eksctl-production-singapore-cluster": AlreadyExistsException: Stack [eksctl-production-singapore-cluster] already exists
	status code: 400, request id: 1c6c1dd6-edd6-4864-a291-0abec73aa7c9

I did what it suggested:

$ eksctl delete cluster --region=ap-southeast-1 --name=production-singapore
2021-07-30 09:08:47 [ℹ]  eksctl version 0.58.0
2021-07-30 09:08:47 [ℹ]  using region ap-southeast-1
2021-07-30 09:08:47 [ℹ]  deleting EKS cluster "production-singapore"
2021-07-30 09:08:49 [!]  stack's status of nodegroup named eksctl-production-singapore-cluster is DELETE_FAILED
2021-07-30 09:08:49 [ℹ]  1 task: { delete cluster control plane "production-singapore" [async] }
2021-07-30 09:08:49 [ℹ]  will delete stack "eksctl-production-singapore-cluster"
2021-07-30 09:08:49 [✔]  all cluster resources were deleted

And yet still cannot create the cluster:

2021-07-30 09:08:26 [ℹ]  building cluster stack "eksctl-production-singapore-cluster"
2021-07-30 09:08:27 [!]  1 error(s) occurred and cluster hasn't been created properly, you may wish to check CloudFormation console
2021-07-30 09:08:27 [ℹ]  to cleanup resources, run 'eksctl delete cluster --region=ap-southeast-1 --name=production-singapore'
2021-07-30 09:08:27 [✖]  creating CloudFormation stack "eksctl-production-singapore-cluster": AlreadyExistsException: Stack [eksctl-production-singapore-cluster] already exists
	status code: 400, request id: 1c6c1dd6-edd6-4864-a291-0abec73aa7c9

@NsikanPatrick
Copy link

I used the eksctl command to delete the cluster and create again with the same name. It didnt work even after clearing all the stacks. Anyone faced this before? Please suggest a work around.

@Alroy261
Copy link

Following this (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-delete-stack.html) resolved the issue!

@dayo777
Copy link

dayo777 commented Dec 22, 2023

Following this (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-delete-stack.html) resolved the issue!

This easy solution worked for me. Thanks.

@jwatte
Copy link

jwatte commented Apr 22, 2024

Any workaround that requires logging into the web console is a bad workaround.
If there were a cloudformation CLI option to do the same thing, maybe it would work as a work-around, but this is clearly not a solved problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/help Request for help
Projects
None yet
Development

No branches or pull requests

8 participants