Kops: Deleting a cluster without an s3 bucket

Created on 8 Sep 2017  路  10Comments  路  Source: kubernetes/kops

I mistakenly deleted the s3 bucket associated with the k8s cluster which I want to delete with the kops delete cluster command. Is there a way to delete a cluster without the associated s3 bucket?

Most helpful comment

The below process will get through a few resources, but I think you'll still have some things lingering such as IAM policies and maybe the VPC:

  1. Set kops s3 state to your S3 bucket
  2. Run kops create cluster with the same cluster name and settings (or kops create -f cluster.yaml if you have the config saved)
  3. Without updating, run kops delete cluster <cluster-name> --yes, which should pick up some matching resources within AWS such as the ASGs, launch configurations etc

As Chris mentioned, remember to enable versioning on the S3 bucket in the future. :)

All 10 comments

I ran in to this recently too and had to just manually clean things up; which, was a much easier task since the (lab/test) cluster happened to be in a dedicated vpc.

I ran in to this recently too and had to just manually clean things up; which, was a much easier task since the (lab/test) cluster happened to be in a dedicated vpc.

Any tips on doing this manually? Whenever I try to terminate ec2 instances, they keep respawning.

You can try importing the cluster maybe ... But the list of stuff we need is in s3.

Btw turning on versioning in s3 is a must!

You can try importing the cluster maybe ... But the list of stuff we need is in s3.

Seems to be a chicken and egg problem - importing it without an s3 bucket gives an error because it needs the s3 bucket which doesn't exist. Simply creating an empty s3 bucket doesn't work either because it seems like the info in the s3 bucket is what is used to do the import?

The below process will get through a few resources, but I think you'll still have some things lingering such as IAM policies and maybe the VPC:

  1. Set kops s3 state to your S3 bucket
  2. Run kops create cluster with the same cluster name and settings (or kops create -f cluster.yaml if you have the config saved)
  3. Without updating, run kops delete cluster <cluster-name> --yes, which should pick up some matching resources within AWS such as the ASGs, launch configurations etc

As Chris mentioned, remember to enable versioning on the S3 bucket in the future. :)

Thanks @KashifSaadat. That worked for one of my clusters but not 2 of the others (I'm guessing I modified them in some way which deviated from the default way clusters are created via kops); but I was able to delete the other 2 by first removing the auto scaling groups.

Thanks @KashifSaadat, It's works for me too.

@KashifSaadat You de boss.

@KashifSaadat Thanks,Its worked for me

Delete the Auto Scaling groups created. :)

Was this page helpful?
0 / 5 - 0 ratings