kubernetes/kops · error

Failed to find floatingip subnet: %v

Error message

Failed to find floatingip subnet: %v

What it means

RenderOpenstack in floatingip.go:249 wraps an error from cloud.GetLBFloatingSubnet() while creating a floating IP. kops tries to allocate the FIP from the same subnet configured as the LB floating subnet; a failure resolving that subnet aborts FIP creation.

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/floatingip.go:249

	if a == nil {
		external, err := cloud.GetExternalNetwork()
		if err != nil {
			return fmt.Errorf("Failed to find external network: %v", err)
		}

		opts := l3floatingip.CreateOpts{
			FloatingNetworkID: external.ID,
			Description:       fi.ValueOf(e.Name),
		}

		if e.LB != nil {
			opts.PortID = fi.ValueOf(e.LB.PortID)
		}

		// instance floatingips comes from the same subnet as the kubernetes API floatingip
		lbSubnet, err := cloud.GetLBFloatingSubnet()
		if err != nil {
			return fmt.Errorf("Failed to find floatingip subnet: %v", err)
		}
		if lbSubnet != nil {
			opts.SubnetID = lbSubnet.ID
		}
		fip, err := cloud.CreateL3FloatingIP(opts)
		if err != nil {
			return fmt.Errorf("Failed to create floating IP: %v", err)
		}

		e.ID = new(fip.ID)
		e.IP = new(fip.FloatingIP)

		return nil
	}
	if changes.Name != nil {
		_, err := l3floatingip.Update(context.TODO(), cloud.NetworkingClient(), fi.ValueOf(a.ID), l3floatingip.UpdateOpts{
			Description: e.Name,
		}).Extract()

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped error; for API errors fix auth/permissions or Neutron health and rerun.
  2. Verify the configured LB floating subnet exists: `openstack subnet list` and correct the cluster spec (e.g. api.floating / cloudConfig subnet settings).
  3. If no dedicated floating subnet is wanted, remove the config so lbSubnet is nil and the FIP allocates from the default pool.
  4. Rerun `kops update cluster --yes` after the config fix.

Example fix

// before (cluster spec)
cloudConfig:
  floatingSubnet: "lb-float-net"  # renamed in OpenStack
// after
cloudConfig:
  floatingSubnet: "floating-net"  # matches `openstack subnet list`
Defensive patterns

Strategy: validation

Validate before calling

// ensure the configured floating subnet exists before creating FIPs
subnets, err := cloud.ListSubnets(subnets.ListOpts{Name: cfgFloatingSubnet})
if err != nil || len(subnets) == 0 {
    return fmt.Errorf("floating subnet %q not found in project", cfgFloatingSubnet)
}

Type guard

func subnetExists(subnets []subnets.Subnet, name string) bool {
    for _, s := range subnets {
        if s.Name == name {
            return true
        }
    }
    return false
}

Try / catch

err := f.RenderOpenstack(target, a, e, changes)
if err != nil && strings.Contains(err.Error(), "Failed to find floatingip subnet") {
    // correct cloudConfig floatingSubnet or unset it to use defaults
}

Prevention

When it happens

Trigger: GetLBFloatingSubnet errors when the configured floating subnet name/tag doesn't resolve in Neutron or the underlying subnet-list API call fails (auth/5xx).

Common situations: `kops set cluster` cloudConfig subnet/floatingSubnet names not matching real Neutron subnets; subnet renamed or deleted; permission issues listing subnets in the external network's project.

Related errors


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