kubernetes/kops · error

Failed to find external network

Error message

Failed to find external network: %v

What it means

RenderOpenstack in floatingip.go:234 wraps an error from cloud.GetExternalNetwork() when creating a new FloatingIP task (a == nil). A floating IP must be allocated from an external (public) network, and kops could not resolve which configured network is the external one.

Solutions

  1. Set the correct external network name in the cluster spec (cluster.spec.networkID / cloudConfig) or via `kops edit cluster`, matching `openstack network list --external`.
  2. Ask the cloud admin to set router:external on the intended public network and grant the project access.
  3. Verify credentials/project scope allow listing networks.
  4. Rerun `kops update cluster` after fixing the config.

Example fix

// before (cluster spec)
cloudConfig:
  externalNetwork: "pubnet"   # wrong name
// after
cloudConfig:
  externalNetwork: "public"   # matches `openstack network list --external`
Defensive patterns

Strategy: validation

Validate before calling

// confirm an external network exists and is visible before creating FIPs
nets, err := cloud.ListNetworks(networks.ListOpts{RouterExternal: true})
if err != nil || len(nets) == 0 {
    return fmt.Errorf("no external network visible to this project; set cloudConfig externalNetwork")
}

Type guard

func hasExternalNetwork(nets []networks.Network) bool {
    for _, n := range nets {
        if n.External {
            return true
        }
    }
    return false
}

Try / catch

err := f.RenderOpenstack(target, a, e, changes)
if err != nil && strings.Contains(err.Error(), "Failed to find external network") {
    // fix cluster.spec cloudConfig externalNetwork, then re-run update
}

Prevention

When it happens

Trigger: GetExternalNetwork fails because no network in the project has router:external=true, the cluster config's external network name doesn't match, or the Neutron list-networks call itself errored.

Common situations: Missing or misnamed `[cloudConfig] externalNetwork` in the kops cluster spec; project lacks permission to see the shared external network; OpenStack admin forgot to mark the public network as external; typo after renaming the network.

Related errors


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

Appendix: source

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

}

func (_ *FloatingIP) ShouldCreate(a, e, changes *FloatingIP) (bool, error) {
	if a == nil {
		return true, nil
	}
	if changes.Name != nil {
		return true, nil
	}
	return false, nil
}

func (f *FloatingIP) RenderOpenstack(t *openstack.OpenstackAPITarget, a, e, changes *FloatingIP) error {
	cloud := t.Cloud

	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

View on GitHub (pinned to 4c8573c808)