kubernetes/kops · error

error creating RouteTable: %v

Error message

error creating RouteTable: %v

What it means

RenderAWS calls EC2 CreateRouteTable to provision a new route table tagged with the cluster tags; any AWS rejection is wrapped as this error. Unlike the find* helpers, this wraps the whole AWS error, so the root cause is embedded in %v.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/routetable.go:187

func (_ *RouteTable) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *RouteTable) error {
	ctx := context.TODO()
	if a == nil {
		vpcID := e.VPC.ID
		if vpcID == nil {
			return fi.RequiredField("VPC.ID")
		}

		klog.V(2).Infof("Creating RouteTable with VPC: %q", *vpcID)

		request := &ec2.CreateRouteTableInput{
			VpcId:             vpcID,
			TagSpecifications: awsup.EC2TagSpecification(ec2types.ResourceTypeRouteTable, e.Tags),
		}

		response, err := t.Cloud.EC2().CreateRouteTable(ctx, request)
		if err != nil {
			return fmt.Errorf("error creating RouteTable: %v", err)
		}

		rt := response.RouteTable
		e.ID = rt.RouteTableId
	}

	return t.AddAWSTags(*e.ID, e.Tags)
}

type terraformRouteTable struct {
	VPCID *terraformWriter.Literal `cty:"vpc_id"`
	Tags  map[string]string        `cty:"tags"`
}

func (_ *RouteTable) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *RouteTable) error {
	// We use the role tag as a concise and stable identifier
	tag := e.Tags[awsup.TagNameKopsRole]
	if tag != "" {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run `kops update cluster` to retry transient failures
  2. Verify the VPC exists: `aws ec2 describe-vpcs --vpc-ids <vpc-id>`
  3. Confirm IAM grants ec2:CreateRouteTable (and ec2:CreateTags)
  4. Check cluster name / tags for invalid characters if TagValidationError appears in the wrapped error

Example fix

// IAM before: no ec2:CreateRouteTable
// after:
{"Effect":"Allow","Action":["ec2:CreateRouteTable","ec2:CreateTags"],"Resource":"*"}
Defensive patterns

Strategy: try-catch

Validate before calling

aws ec2 describe-vpcs --vpc-ids vpc-123 --region us-east-1 || echo "VPC missing"

Try / catch

var aerr smithy.APIError
if errors.As(err, &aerr) {
  switch aerr.ErrorCode() {
  case "ThrottlingException": backoffAndRetry()
  case "InvalidVpcID.NotFound": recreateVPCState()
  default: return err
  }
}

Prevention

When it happens

Trigger: CreateRouteTable fails: VPC ID invalid/deleted, missing ec2:CreateRouteTable permission, throttling, or invalid TagSpecifications (too many/illegal tag values).

Common situations: VPC deleted out-of-band while cluster state references it; IAM policy too restrictive; AWS throttling during large cluster creation; tag value containing invalid characters from an unusual cluster name.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/1354589800a18c5e. Report an issue: GitHub.