kubernetes/kops · error

did not find floatingsubnet for LB

Error message

did not find floatingsubnet for LB

What it means

getLBFloatingSubnet resolves the dedicated floating subnet used for load balancer VIPs. Like getExternalSubnet it requires exactly one matching subnet; otherwise it returns "did not find floatingsubnet for LB". The candidate set comes from the cluster's configured floatingSubnet filter.

Source

Thrown at upup/pkg/fi/cloudup/openstack/subnet.go:170

	return getLBFloatingSubnet(c, c.floatingSubnet)
}

func getLBFloatingSubnet(c OpenstackCloud, floatingSubnet *string) (subnet *subnets.Subnet, err error) {
	if floatingSubnet == nil {
		return nil, nil
	}

	subnets, err := c.ListSubnets(subnets.ListOpts{
		Name: fi.ValueOf(floatingSubnet),
	})
	if err != nil {
		return nil, err
	}

	if len(subnets) == 1 {
		return &subnets[0], nil
	}
	return nil, fmt.Errorf("did not find floatingsubnet for LB")
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set spec.network.floatingSubnet (id, name, tag, or cidr) in the cluster spec to uniquely identify one subnet
  2. Verify with `openstack subnet list` that the configured filter matches exactly one subnet
  3. Re-create the LB floating subnet if it was deleted
  4. Re-run kops after correcting the spec

Example fix

// before
spec:
  network:
    externalNetwork: public
// after: uniquely identify the LB floating subnet
spec:
  network:
    externalNetwork: public
    floatingSubnet:
      name: lb-float-subnet
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the configured floatingSubnet filter matches exactly one subnet
matches := filterSubnets(allSubnets, cfg.FloatingSubnet)
if len(matches) != 1 {
	log.Fatalf("floatingSubnet config matched %d subnets, need exactly 1", len(matches))
}

Try / catch

sub, err := GetLBFloatingSubnet(cloud)
if err != nil {
	if strings.Contains(err.Error(), "did not find floatingsubnet for LB") {
		// correct spec.network.floatingSubnet and retry
	}
	return err
}

Prevention

When it happens

Trigger: The LB floating subnet filter in cluster config matches zero or multiple subnets in the external network, so len(subnets) != 1.

Common situations: Misconfigured or missing `spec.network.floatingSubnet` in the cluster spec, renamed/deleted LB subnet in OpenStack, or a filter that now matches several subnets after network changes.

Related errors


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