kubernetes/kops · error

Failed to find floatingip subnet: %v

Error message

Failed to find floatingip subnet: %v

What it means

This error is raised in the Openstack Router task's RenderOpenstack (router.go:114) while building the gateway options for a new Neutron router. After resolving the external network, kOps calls Cloud.GetExternalSubnet() to discover the floating-IP subnet to pin the router's external gateway to; if that lookup fails for any reason, the underlying error is wrapped with this message and cluster creation is aborted.

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/router.go:114

		klog.V(2).Infof("Creating Router with name:%q", fi.ValueOf(e.Name))

		opt := routers.CreateOpts{
			Name:                  fi.ValueOf(e.Name),
			AdminStateUp:          new(true),
			AvailabilityZoneHints: fi.StringSliceValue(e.AvailabilityZoneHints),
		}
		floatingNet, err := t.Cloud.GetExternalNetwork()
		if err != nil {
			return fmt.Errorf("Error creating router.  Could not list external networks for gateway: %v", err)
		}

		opt.GatewayInfo = &routers.GatewayInfo{
			NetworkID: floatingNet.ID,
		}

		routerFloatingSubnet, err := t.Cloud.GetExternalSubnet()
		if err != nil {
			return fmt.Errorf("Failed to find floatingip subnet: %v", err)
		}
		if routerFloatingSubnet != nil {
			opt.GatewayInfo.ExternalFixedIPs = []routers.ExternalFixedIP{
				{
					SubnetID: routerFloatingSubnet.ID,
				},
			}
		}

		v, err := t.Cloud.CreateRouter(opt)
		if err != nil {
			return fmt.Errorf("Error creating router: %v", err)
		}
		e.ID = new(v.ID)
		klog.V(2).Infof("Creating a new Openstack router, id=%s", v.ID)
		return nil
	}
	e.ID = a.ID

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the external network has at least one subnet: `openstack network show <ext-net>` and `openstack subnet list --network <ext-net>`; create one if missing
  2. Check Neutron RBAC/policy so the kOps project can list subnets on the external network (admin or shared network RBAC)
  3. Re-run with klog -v=2 / check the wrapped inner error to identify whether it's auth, timeout, or empty-result related
  4. Retry the apply after resolving transient Neutron API issues

Example fix

// before: floating subnet missing on external network
$ openstack subnet list --network public
(empty)
// after
$ openstack subnet create --network public --subnet-range 203.0.113.0/24 public-subnet
Defensive patterns

Strategy: validation

Validate before calling

// before applying, verify external network/subnet visibility
subnets, err := netClient.ListSubnets(subnets.ListOpts{NetworkID: extNetID}).AllPages()
if err != nil { return fmt.Errorf("cannot list subnets on external network %s: %w", extNetID, err) }
if len(subnets) == 0 { return fmt.Errorf("external network %s has no subnets; create one before kops update", extNetID) }

Try / catch

// wrap the apply and surface the inner cause
if err := kopsUpdate(); err != nil {
    var gerr gophercloud.ErrUnexpectedResponseCode
    if errors.As(err, &gerr) && gerr.Actual == http.StatusForbidden {
        log.Printf("check Neutron RBAC: cannot list subnets on external network: %v", gerr)
    }
    return err
}

Prevention

When it happens

Trigger: Cloud.GetExternalSubnet() returns an error during `kops update cluster` on OpenStack — typically the Neutron subnet-list API call fails, the external (floating) network has no visible subnets due to policy/ACL restrictions, or the external network configuration in the cloud is missing/misconfigured so the lookup can't resolve a subnet.

Common situations: Operator hasn't created a subnet on the external network, the credentials/project used by kOps lack permission to list subnets on the external network, a typo'd or stale --os-* env/cluster config points at a project that can't see the floating network, or a Neutron outage/timeout occurs mid-apply.

Related errors


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