kubernetes/kops · error
NewSubnetTaskFromCloud: Failed to get network with ID %s: %v
Error message
NewSubnetTaskFromCloud: Failed to get network with ID %s: %v
What it means
NewSubnetTaskFromCloud builds a Subnet task from an existing OpenStack subnet and first fetches its parent network via cloud.GetNetwork(subnet.NetworkID). This error means that Neutron API lookup failed, so the subnet's parent network could not be resolved. It is raised during `kops get`/Find reconciliation when listing subnets.
Source
Thrown at upup/pkg/fi/cloudup/openstacktasks/subnet.go:61
var deps []fi.CloudupTask
for _, task := range tasks {
if _, ok := task.(*Network); ok {
deps = append(deps, task)
}
}
return deps
}
var _ fi.CompareWithID = (*Subnet)(nil)
func (s *Subnet) CompareWithID() *string {
return s.ID
}
func NewSubnetTaskFromCloud(cloud openstack.OpenstackCloud, lifecycle fi.Lifecycle, subnet *subnets.Subnet, find *Subnet) (*Subnet, error) {
network, err := cloud.GetNetwork(subnet.NetworkID)
if err != nil {
return nil, fmt.Errorf("NewSubnetTaskFromCloud: Failed to get network with ID %s: %v", subnet.NetworkID, err)
}
networkTask, err := NewNetworkTaskFromCloud(cloud, lifecycle, network, find.Tag)
if err != nil {
return nil, fmt.Errorf("error creating network task from cloud: %v", err)
}
nameservers := make([]*string, len(subnet.DNSNameservers))
for i, ns := range subnet.DNSNameservers {
nameservers[i] = new(ns)
}
tag := ""
if find != nil && fi.ArrayContains(subnet.Tags, fi.ValueOf(find.Tag)) {
tag = fi.ValueOf(find.Tag)
}
actual := &Subnet{
ID: new(subnet.ID),View on GitHub (pinned to 4c8573c808)
Solutions
- Verify the network exists and is visible: `openstack network show <NetworkID>` with the same OS_* credentials kOps uses.
- If the network was deleted, update the cluster spec's network/subnet IDs (or delete/recreate the cluster's network config).
- Re-run with correct project/region scope (check OS_PROJECT_ID / OS_REGION_NAME) if the ID belongs to another project.
- If Neutron returned 5xx/timeout, retry after confirming `openstack network list` works.
Example fix
# check the referenced network $ openstack network show <subnet.NetworkID> # 404 -> fix cluster spec to reference an existing network kops edit cluster # update networkID/subnet ids kops update cluster
Defensive patterns
Strategy: validation
Validate before calling
// Validate the referenced network before reconcile:
network, err := cloud.GetNetwork(subnet.NetworkID)
if err != nil {
if _, ok := err.(gophercloud.ErrDefault404); ok {
return fmt.Errorf("network %s does not exist (deleted or wrong project/region); fix the cluster spec", subnet.NetworkID)
}
return err
} Type guard
func networkExists(cloud openstack.OpenstackCloud, id string) bool {
n, err := cloud.GetNetwork(id)
return err == nil && n != nil && n.ID != ""
} Prevention
- After any manual Neutron changes, re-verify network/subnet IDs referenced in the cluster spec.
- Use the same OS_PROJECT_ID/OS_REGION_NAME scope for kops as for your `openstack` CLI checks.
- Never delete the cluster's network while the cluster exists.
- Pin OS_* env vars in CI so kops doesn't silently operate against a different project.
When it happens
Trigger: Subnet.Find lists a subnet successfully, then NewSubnetTaskFromCloud calls cloud.GetNetwork(subnet.NetworkID) and Neutron returns an error — typically 404 because the network was deleted after the subnet record (or the ID is stale from another project/region), or an auth/endpoint failure.
Common situations: Cluster spec references a network/subnet that was deleted out-of-band in OpenStack; subnet.NetworkID points to a network in a different OpenStack project the credentials can't see; OS_REGION_NAME or project scope changed so the network ID no longer resolves; transient Neutron outage.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- error listing subnets: %v
- error describing Network: %v
- network %q not found
- error listing subnets in network %q: %v
- error retrieving subnet with id %s: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/1154a4c7d0096a98.
Report an issue: GitHub.