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

RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists #5

Closed
ialidzhikov opened this issue Dec 13, 2019 · 4 comments
Closed
Labels

Comments

@ialidzhikov
Copy link
Member

ialidzhikov commented Dec 13, 2019

We do often see provider-aws terraformer to fail during Shoot creation with error:

Last ErrorFlow "Shoot cluster reconciliation" encountered task errors: [task "Waiting until shoot infrastructure has been reconciled" failed: failed to create infrastructure: retry failed with context deadline exceeded, last error: extension encountered error during reconciliation: Error reconciling infrastructure: Terraform execution job 'foo.infra.tf-job' could not be completed. The following issues have been found in the logs:

-> Pod 'foo.infra.tf-job-8tvwz' reported:
* [0m[0m[1mError creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.
    status code: 400, request id: <omitted>[0m
[0m  on tf/main.tf line 221, in resource "aws_route" "private_utility_z0_nat":
 221: resource "aws_route" "private_utility_z0_nat" [4m{[0m
[0m
[0m[0m]

We see that the route is present in the provider, but it is missing in terraform.tfstate which make terraform try to create it and fail.
We see this since several terraform versions (0.12.9 - the current one, 0.11.14, and probably even an older one).

@rfranzke
Copy link
Member

rfranzke commented Dec 30, 2019

Anyone having time to implement a mitigation?

Manual steps with gardenctl:

g aws ec2 -- describe-route-tables --output=json --filters "Name=vpc-id,Values=vpc-123456" // Replace vpc-id by actual id

g aws ec2 -- delete-route --route-table-id=rtb-abcdef --destination-cidr-block=0.0.0.0/0 // Fetch route-table id related to the nat-gateway and replace it.

@rfranzke rfranzke transferred this issue from gardener-attic/gardener-extensions Jan 30, 2020
@ialidzhikov ialidzhikov added the kind/bug Bug label Feb 8, 2020
@vlerenc
Copy link
Member

vlerenc commented Feb 9, 2020

Thx for reporting and indeed, a fix in TF or mitigation in G would be great, otherwise we suffer from it endlessly.

@ialidzhikov
Copy link
Member Author

Actually we found that the initial terraform apply for the described case fails with:

# ...
aws_route.private_utility_z0_nat: Still creating... [1m30s elapsed]
aws_route.private_utility_z0_nat: Still creating... [1m40s elapsed]
aws_route.private_utility_z0_nat: Still creating... [1m50s elapsed]
aws_route.private_utility_z0_nat: Still creating... [2m0s elapsed]

Error finding route after creating it: Unable to find matching route for Route Table (rtb-1234) and destination CIDR block (0.0.0.0/0).
on tf/main.tf line 183, in resource "aws_route" "private_utility_z0_nat":
183: resource "aws_route" "private_utility_z0_nat" 

The aws_route creation times out (the default creation timeout is 2m ). The aws_route is not persistent in the terraform.state and it actually gets created in the cloud provider.
Subsequent terraform apply runs will try to create this aws_route and they will always fail with RouteAlreadyExists .

There are multiple existing issues about Error finding route after creating it: Unable to find matching route for Route Table (rtb-1234) and destination CIDR block (0.0.0.0/0), I linked several ones in hashicorp/terraform-provider-aws#12073. In some of them people report that they increased the creation timeout for the aws_route and that fixed the issue for them.
We also agreed to do that.

@ialidzhikov
Copy link
Member Author

I am closing for now as is merged #38 . Please reopen if it still reproduces.

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

No branches or pull requests

3 participants