kubernetes/kops · error

found multiple RouteTables attached to subnet

Error message

found multiple RouteTables attached to subnet

What it means

kOps expects exactly one route table associated with a subnet when reconciling; more than one attached route table is ambiguous (the explicit association and possibly the main route table propagated), so kOps fails rather than guessing.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/routetableassociation.go:143

	if subnet.ID == nil {
		return nil, fmt.Errorf("subnet ID not set")
	}

	subnetID := fi.ValueOf(subnet.ID)

	request := &ec2.DescribeRouteTablesInput{
		Filters: []ec2types.Filter{awsup.NewEC2Filter("association.subnet-id", subnetID)},
	}
	response, err := cloud.EC2().DescribeRouteTables(ctx, request)
	if err != nil {
		return nil, fmt.Errorf("error listing RouteTables for subnet %q: %v", subnetID, err)
	}
	if response == nil || len(response.RouteTables) == 0 {
		return nil, nil
	}

	if len(response.RouteTables) != 1 {
		return nil, fmt.Errorf("found multiple RouteTables attached to subnet")
	}
	rt := response.RouteTables[0]
	return &rt, nil
}

func (_ *RouteTableAssociation) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *RouteTableAssociation) error {
	ctx := context.TODO()
	if a == nil {
		// TODO: We might do better just to make the subnet the primary key here

		klog.V(2).Infof("Checking for existing RouteTableAssociation to subnet")
		existing, err := findExistingRouteTableForSubnet(t.Cloud, e.Subnet)
		if err != nil {
			return fmt.Errorf("error checking for existing RouteTableAssociation: %v", err)
		}

		if existing != nil {
			for _, a := range existing.Associations {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. List the subnet's route table associations in the AWS console/CLI and remove the unintended one: aws ec2 describe-route-tables --filters Name=association.subnet-id,Values=<subnet-id>
  2. Ensure only the kOps-managed route table is explicitly associated with the subnet
  3. If a second table is intentional, manage associations outside the kOps RouteTableAssociation task or disable route-table management for that subnet
  4. Re-run kops update after cleanup

Example fix

// inspect then disassociate the extra table
aws ec2 describe-route-tables --filters Name=association.subnet-id,Values=subnet-0abc
aws ec2 disassociate-route-table --association-id <extra-association-id>
Defensive patterns

Strategy: validation

Validate before calling

aws ec2 describe-route-tables --filters Name=association.subnet-id,Values=<subnet-id> --query 'length(RouteTables)'

Prevention

When it happens

Trigger: DescribeRouteTables filtered by association.subnet-id returns 2+ route tables for the same subnet during RenderAWS of a RouteTableAssociation.

Common situations: Operators manually associated an extra route table (e.g., a appliance/inspection route table) to a kOps-managed subnet; multiple controllers (kOps + Terraform/console) managing routing; shared-subnet setups where another team attached routes.

Related errors


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