kubernetes/kops · error
unable to tag route table
Error message
unable to tag route table %v
What it means
After tagging the subnet, a shared NAT gateway also tags its associated route table via AddAWSTags(fi.ValueOf(e.AssociatedRouteTable.ID), tags). If the AWS CreateTags call for the route table fails, RenderAWS wraps it as "unable to tag route table %v".
Solutions
- Inspect the wrapped cause: fix IAM (allow ec2:CreateTags on route-table ARNs) if UnauthorizedOperation
- If the route table is not found, correct the AssociatedRouteTable ID in the spec and re-apply
- Retry on transient throttling errors
Example fix
// before policy without route-table tag permission // after allow ec2:CreateTags on arn:aws:ec2:*:*:route-table/*
Defensive patterns
Strategy: retry
Validate before calling
_, err := cloud.EC2().DescribeRouteTables(&ec2.DescribeRouteTablesInput{RouteTableIds: []string{*rtID}})
if err != nil { return fmt.Errorf("route table %s missing: %w", *rtID, err) } Try / catch
if err != nil {
var awsErr smithy.APIError
if errors.As(err, &awsErr) && awsErr.ErrorCode() == "UnauthorizedOperation" {
// fix IAM: ec2:CreateTags on route-table ARNs
}
} Prevention
- Allow ec2:CreateTags on route-table ARNs in IAM
- Verify the route table ID exists before applying
- Retry transient throttling
When it happens
Trigger: AddAWSTags on the route table returns an error during RenderAWS of a shared NGW — InvalidRouteTableID.NotFound, ec2:CreateTags authorization failure, or AWS throttling.
Common situations: IAM policy not allowing ec2:CreateTags on route tables; route table deleted externally; transient AWS API errors during apply.
Related errors
- error describing RouteTables
- error finding AssociatedNatGatewayRouteTable
- error from DescribeRouteTables
- unable to tag subnet
- AssociatedRouteTable not provided
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/453302cd714c6e96.
Report an issue: GitHub.
Appendix: source
Thrown at upup/pkg/fi/cloudup/awstasks/natgateway.go:361
tags["AssociatedNatgateway"] = *id
err = t.AddAWSTags(*e.Subnet.ID, tags)
if err != nil {
return fmt.Errorf("unable to tag subnet %v", err)
}
// If this is a shared NGW, we need to tag it
// The tag that implies "shared" is `AssociatedNatgateway`=> NGW-ID
// This is better than just a tag that's shared because this lets us create a whitelist of these NGWs
// without doing a bunch more work in `kutil/delete_cluster.go`
if fi.ValueOf(e.Shared) {
if e.AssociatedRouteTable == nil {
return fmt.Errorf("AssociatedRouteTable not provided")
}
klog.V(2).Infof("tagging route table %s to track shared NGW", fi.ValueOf(e.AssociatedRouteTable.ID))
err = t.AddAWSTags(fi.ValueOf(e.AssociatedRouteTable.ID), tags)
if err != nil {
return fmt.Errorf("unable to tag route table %v", err)
}
}
return nil
}
type terraformNATGateway struct {
AllocationID *terraformWriter.Literal `cty:"allocation_id"`
SubnetID *terraformWriter.Literal `cty:"subnet_id"`
Tag map[string]string `cty:"tags"`
}
func (_ *NatGateway) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *NatGateway) error {
if fi.ValueOf(e.Shared) {
if e.ID == nil {
return fmt.Errorf("ID must be set, if NatGateway is shared: %s", e)
}
View on GitHub (pinned to 4c8573c808)