kubernetes/kops · error

found multiple interfaces which subnet:%s attach to

Error message

found multiple interfaces which subnet:%s attach to

What it means

Raised in RouterInterface.Find (routerinterface.go:80). When reconciling, kOps lists ports attached to the router on the subnet's network and scans their FixedIPs for one matching the task's subnet. If more than one such port/interface is found, the desired state is ambiguous, so it fails rather than guessing which router interface to reuse.

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/routerinterface.go:80

		DeviceID:  fi.ValueOf(i.Router.ID),
		ID:        fi.ValueOf(i.ID),
	}
	ps, err := cloud.ListPorts(opt)
	if err != nil {
		return nil, err
	}
	if ps == nil {
		return nil, nil
	}

	var actual *RouterInterface

	subnetID := fi.ValueOf(i.Subnet.ID)
	for _, p := range ps {
		for _, ip := range p.FixedIPs {
			if ip.SubnetID == subnetID {
				if actual != nil {
					return nil, fmt.Errorf("found multiple interfaces which subnet:%s attach to", subnetID)
				}
				actual = &RouterInterface{
					ID:        new(p.ID),
					Name:      i.Name,
					Router:    i.Router,
					Subnet:    i.Subnet,
					Lifecycle: i.Lifecycle,
				}
				i.ID = actual.ID
			}
		}
	}
	return actual, nil
}

func (i *RouterInterface) Run(context *fi.CloudupContext) error {
	return fi.CloudupDefaultDeltaRunMethod(i, context)
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the duplicate ports: `openstack port list --device-id <router-id>` and identify ports with fixed IPs in the target subnet
  2. Detach the extra interface: `openstack router remove subnet <router> <subnet>` (or delete the stale port), keeping one
  3. Re-run `kops update cluster` so Find resolves a single interface
  4. Prevent recurrence by never manually adding the cluster subnet to the router outside kOps

Example fix

// before: two router ports on subnet
$ openstack port list --device-id <router-id>  # two ports with fixed IPs in subnet X
// after
$ openstack router remove subnet <router> <subnet-X>
$ kops update cluster <name> --yes
Defensive patterns

Strategy: validation

Validate before calling

// before applying, ensure the router has at most one interface on the subnet
ports, _ := ports.List(netClient, ports.ListOpts{DeviceID: routerID, NetworkID: netID}).AllPages()
count := 0
for _, p := range ports { for _, ip := range p.FixedIPs { if ip.SubnetID == subnetID { count++ } } }
if count > 1 { return fmt.Errorf("router %s has %d interfaces on subnet %s; detach extras first", routerID, count, subnetID) }

Try / catch

if err := kopsUpdate(); err != nil {
    if strings.Contains(err.Error(), "found multiple interfaces") {
        log.Fatal("detach duplicate router interfaces: openstack router remove subnet <router> <subnet>")
    }
    return err
}

Prevention

When it happens

Trigger: ListPorts filtered by NetworkID + DeviceID (router) returns multiple ports whose FixedIPs include the same SubnetID — i.e., the router has more than one interface on that subnet, usually left over from a previous failed/partial apply or manual `openstack router add subnet` calls.

Common situations: A previous `kops update` timed out after creating the interface but before recording the port ID, then a retry added a second interface; an operator manually attached the subnet to the router; duplicated ports from Neutron after a failed interface detach.

Related errors


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