kubernetes/kops · error
Error creating router. Could not list external networks…
Error message
Error creating router. Could not list external networks for gateway: %v
What it means
Router.RenderOpenstack, while creating a router, calls t.Cloud.GetExternalNetwork() to determine the floating/external network for the router gateway. If that lookup fails, the error is wrapped with this message, indicating the router could not be configured with an external gateway.
Solutions
- Verify an external network exists: `openstack network list --external` (needs router:external=True)
- Create or designate an external/floating network in the Openstack cloud if missing
- Check the cluster spec's external network configuration matches the cloud
- Grant the project access to the shared external network if visibility is the issue
- Inspect the wrapped error for API/auth failures and re-run kops
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
extNets, err := cloud.ListNetworks(networks.ListOpts{"router:external": true})
if err != nil || len(extNets) == 0 {
return fmt.Errorf("no external network with router:external=True available for router gateway")
} Try / catch
floatingNet, err := t.Cloud.GetExternalNetwork()
if err != nil {
return fmt.Errorf("Error creating router. Could not list external networks for gateway: %v", err)
} // fix cloud config (external network) before retrying Prevention
- Confirm `openstack network list --external` returns a network before cluster create
- Create/designate a floating IP network in the Openstack cloud
- Ensure the project has visibility of the shared external network
- Match the kops spec's external network setting to the actual cloud topology
When it happens
Trigger: Create path (a==nil) and GetExternalNetwork returns an error — no external network can be listed (none marked router:external, listing API error, or auth failure).
Common situations: Openstack deployment has no external network defined (no network with router:external=True); the project lacks visibility of the external network; Neutron API/credential issues; `externalNet` config mismatch in the kops cluster spec.
Related errors
- Error creating router
- Failed to find floatingip subnet
- found multiple routers with name
- Additional SecurityGroup not found for name
- cluster configured to use octavia, but router was not…
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/2aaa34407afa35ab.
Report an issue: GitHub.
Appendix: source
Thrown at upup/pkg/fi/cloudup/openstacktasks/router.go:105
if changes.AvailabilityZoneHints != nil {
return fi.CannotChangeField("AvailabilityZoneHints")
}
}
return nil
}
func (_ *Router) RenderOpenstack(t *openstack.OpenstackAPITarget, a, e, changes *Router) error {
if a == nil {
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,
},
}
}
View on GitHub (pinned to 4c8573c808)