kubernetes/kops · error
error deleting RouteTable %q: %v
Error message
error deleting RouteTable %q: %v
What it means
kOps wraps failures from the EC2 DeleteRouteTable API. Errors classified as dependency violations are returned unwrapped so the caller's retry loop can back off; all other errors are wrapped with the route table ID. It means the route table could not be deleted for a non-dependency reason.
Source
Thrown at pkg/resources/aws/aws.go:911
c := cloud.(awsup.AWSCloud)
id := r.ID
klog.V(2).Infof("Deleting EC2 RouteTable %q", id)
request := &ec2.DeleteRouteTableInput{
RouteTableId: &id,
}
_, err := c.EC2().DeleteRouteTable(ctx, request)
if err != nil {
if awsup.AWSErrorCode(err) == "InvalidRouteTableID.NotFound" {
klog.V(2).Infof("Got InvalidRouteTableID.NotFound error describing RouteTable %q; will treat as already-deleted", id)
return nil
}
if IsDependencyViolation(err) {
return err
}
return fmt.Errorf("error deleting RouteTable %q: %v", id, err)
}
return nil
}
// DescribeRouteTablesIgnoreTags returns all ec2.RouteTable, ignoring tags
func DescribeRouteTablesIgnoreTags(cloud fi.Cloud) ([]ec2types.RouteTable, error) {
ctx := context.TODO()
c := cloud.(awsup.AWSCloud)
klog.V(2).Infof("Listing all RouteTables")
request := &ec2.DescribeRouteTablesInput{}
response, err := c.EC2().DescribeRouteTables(ctx, request)
if err != nil {
return nil, fmt.Errorf("error listing RouteTables: %v", err)
}
return response.RouteTables, nil
}View on GitHub (pinned to 4c8573c808)
Solutions
- Check if the route table already exists: `aws ec2 describe-route-tables --route-table-ids <id>`; if NotFound, it is already deleted — skip it
- If throttled, wait and retry; kOps callers retry on dependency violations automatically
- Verify IAM permissions for ec2:DeleteRouteTable on the route table ARN
- Re-run kOps delete; it is idempotent and will skip missing resources
Example fix
// before: assuming error means table still exists
return fmt.Errorf("error deleting RouteTable %q: %v", id, err)
// after: treat NotFound as success in caller
if awsup.AWSErrorCode(err) == "InvalidRouteTableID.NotFound" {
return nil
} Defensive patterns
Strategy: validation
Validate before calling
// confirm the route table still exists before deleting
out, err := c.EC2().DescribeRouteTables(ctx, &ec2.DescribeRouteTablesInput{
RouteTableIds: []string{id},
})
if err != nil { return err }
if len(out.RouteTables) == 0 {
return nil // already deleted
} Type guard
func routeTableExists(out *ec2.DescribeRouteTablesOutput) bool {
return out != nil && len(out.RouteTables) == 1
} Try / catch
if err != nil {
if awsup.AWSErrorCode(err) == "InvalidRouteTableID.NotFound" {
return nil // already deleted
}
if awserrors.IsDependencyViolation(err) {
return err // let caller backoff-retry
}
return fmt.Errorf("error deleting RouteTable %q: %v", id, err)
} Prevention
- Always run kops delete a second time; it is idempotent for missing resources
- Verify IAM permissions include ec2:DeleteRouteTable before teardown
- Check `aws ec2 describe-route-tables` to see if another operator already removed it
- Avoid deleting VPC resources manually alongside a kOps delete
When it happens
Trigger: EC2 DeleteRouteTable returns an error other than a dependency violation: wrong/unknown route table ID (InvalidRouteTableID.NotFound is not special-cased here), throttling, or auth failure.
Common situations: The route table was already deleted by another process or a previous partial run, so the ID no longer exists; IAM policy lacks ec2:DeleteRouteTable; API throttling during bulk cluster teardown.
Related errors
- error describing RouteTables: %v
- error listing RouteTables: %v
- error deleting DhcpOptions %q: %v
- error deleting InternetGateway %q: %v
- error from DescribeRouteTables: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/74a5937fb461b629.
Report an issue: GitHub.