{"record":{"id":"262fcd67a9a542e1","repo":"kubernetes/kops","slug":"subnet-s-not-found-in-network-s","errorCode":null,"errorMessage":"subnet %s not found in network %s","messagePattern":"subnet (.+?) not found in network (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":959,"sourceCode":"\tosCloud.UseZones(zones)\n\n\tnetworkInfo, err := osCloud.FindVPCInfo(cluster.Spec.Networking.NetworkID)\n\tif err != nil {\n\t\treturn res, fmt.Errorf(\"error describing Network: %v\", err)\n\t}\n\tif networkInfo == nil {\n\t\treturn res, fmt.Errorf(\"network %q not found\", cluster.Spec.Networking.NetworkID)\n\t}\n\n\tsubnetByID := make(map[string]*fi.SubnetInfo)\n\tfor _, subnetInfo := range networkInfo.Subnets {\n\t\tsubnetByID[subnetInfo.ID] = subnetInfo\n\t}\n\n\tfor _, subnetID := range subnetIDs {\n\t\tsubnet, ok := subnetByID[subnetID]\n\t\tif !ok {\n\t\t\treturn res, fmt.Errorf(\"subnet %s not found in network %s\", subnetID, cluster.Spec.Networking.NetworkID)\n\t\t}\n\n\t\tif res[subnet.Zone] != \"\" {\n\t\t\treturn res, fmt.Errorf(\"subnet %s and %s have the same zone\", subnetID, res[subnet.Zone])\n\t\t}\n\t\tres[subnet.Zone] = subnetID\n\t}\n\treturn res, nil\n}\n\nfunc setupControlPlane(opt *NewClusterOptions, cluster *api.Cluster, zoneToSubnetsMap map[string][]*api.ClusterSubnetSpec) ([]*api.InstanceGroup, error) {\n\tcloudProvider := cluster.GetCloudProvider()\n\n\tvar controlPlanes []*api.InstanceGroup\n\n\t// Build the control-plane subnets.\n\t// The control-plane zones is the default set of zones unless explicitly set.\n\t// The control-plane count is the number of control-plane zones unless explicitly set.","sourceCodeStart":941,"sourceCodeEnd":977,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L941-L977","documentation":"kops is creating a new cluster on OpenStack and needs to map each availability zone to a subnet provider ID. It looks up every user-supplied subnet ID in the subnets discovered for the cluster's network (cluster.Spec.Networking.NetworkID). This error means one of the requested subnet IDs does not exist within that network, so the zone-to-subnet mapping cannot be built.","triggerScenarios":"Running `kops create cluster` against OpenStack with --network (NetworkID) set and subnet IDs (via zones/subnet flags wired through setupZones or setupTopology) that do not belong to the specified network: a typo in the subnet ID, a subnet from a different network/project, or a subnet that was deleted before cluster creation.","commonSituations":"Copy-pasting a subnet ID from another OpenStack project or region; specifying a subnet belonging to a different Neutron network than the one given; stale documentation/scripts referencing a deleted subnet; confusion between subnet name and subnet ID.","solutions":["Verify each subnet ID exists in the network: `openstack subnet list --network <network-id>` and correct the flag values.","If the network ID is wrong, pass the correct one via --network so the subnets resolve.","Remove or replace subnets that belong to other projects/networks; ensure the OpenStack credentials can see the target project.","Use a shared network/subnet properly (RBAC) if the subnets intentionally live in another project."],"exampleFix":"// before\nkops create cluster ... --network net-1234 --zones nova-a --os-subnet-id wrong-subnet\n// after\nopenstack subnet list --network net-1234   # pick an ID actually in net-1234\nkops create cluster ... --network net-1234 --os-subnet-id <subnet-in-net-1234>","handlingStrategy":"validation","validationCode":"openstack subnet list --network <NETWORK_ID>  # ensure every --os-subnet-id appears here before create","typeGuard":null,"tryCatchPattern":"if err := createCluster(); err != nil && strings.Contains(err.Error(), \"not found in network\") { /* re-check subnet IDs vs network ID, correct flags, retry once */ }","preventionTips":["List subnets of the exact network before running create cluster","Distinguish subnet IDs (UUIDs) from names","Keep network and subnet IDs in the same project/region","Verify credentials target the right OpenStack project"],"tags":["openstack","subnet","cluster-creation","configuration"],"backgroundTag":"subnet-not-found-in-network","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}