Kops: Deleting shared vpc and subnets

Created on 6 Jul 2017  路  6Comments  路  Source: kubernetes/kops

Setup

VPC and subnets are created and tagged by terraform, except the version of TF that I have is not setting the value "shared"

VPC tags

Name | byo-vpc-public-ha.aws.k8spro.com
KubernetesCluster | byo-vpc-public-ha.aws.k8spro.com
kubernetes.io/cluster/byo-vpc-public-ha.aws.k8spro.com | shared

Subnet Tags

Name | us-east-1c.byo-vpc-public-ha.aws.k8spro.com
KubernetesCluster | byo-vpc-public-ha.aws.k8spro.com
kubernetes.io/cluster/byo-vpc-public-ha.aws.k8spro.com | shared

Create

Using kops create cluster -f mycluster.yaml with the vpc and subnet id set.

Delete

$ kops delete cluster --name byo-vpc-public-ha.aws.k8spro.com

Shows that

subnet          us-east-1b.byo-vpc-public-ha.aws.k8spro.com                         subnet-d261e3fe
subnet          us-east-1c.byo-vpc-public-ha.aws.k8spro.com                         subnet-8edea4c6
subnet          us-east-1d.byo-vpc-public-ha.aws.k8spro.com                         subnet-bc2d97e6
vpc         byo-vpc-public-ha.aws.k8spro.com                                vpc-96ad24ef

Are going to be deleted.

$ kops delete cluster --name byo-vpc-public-ha.aws.k8spro.com --yes

Deletes both the VPC and the subnets.

Solution

I think the problem is that we are are using BuildEC2Filters for describing the VPC and Subnets. Which is correct, but then we are deleting the returned VPCs, and not checking that they are set up as shared.

We could look at skipping the deletion if the label includes shared, or if any of the items returned are not labeled.

Most helpful comment

Here is the PR that fixes the problem https://github.com/kubernetes/kops/pull/2960

All 6 comments

I cannot find the original issue with deleting subnets, so I created a new one.

Had the same issue.
Creating a cluster on a shared VPC and updated it to use the subnets already existent.
When attempted to delete the cluster Kops was trying to delete these same subnets that it had not created.

FWIW, I am using kops v1.6.0 and did not see this issue. I am assuming the bug was introduced after that -- I would love to hear what versions of kops folks are finding this issue present in so others can safely avoid them. I am going to avoid upgrading until this is released.

The bug still is in master, i am hoping that we are able to get the fix into 1.7.0, but it will be on 1.7.1.

Here is the PR that fixes the problem https://github.com/kubernetes/kops/pull/2960

This should be fixed now in master

Was this page helpful?
0 / 5 - 0 ratings