{"record":{"id":"a608aed5a22bfb35","repo":"kubernetes/kops","slug":"spotinstancegroup-q-uses-subnet-q-that-does-not","errorCode":null,"errorMessage":"SpotInstanceGroup %q uses subnet %q that does not exist","messagePattern":"SpotInstanceGroup %q uses subnet %q that does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/spotinst.go","lineNumber":738,"sourceCode":"\tfor i, subnet := range subnets {\n\t\tout[i] = b.LinkToSubnet(subnet)\n\t}\n\n\treturn out, nil\n}\n\nfunc (b *SpotInstanceGroupModelBuilder) buildPublicIPOpts(ig *kops.InstanceGroup) (*bool, error) {\n\tsubnetMap := make(map[string]*kops.ClusterSubnetSpec)\n\tfor i := range b.Cluster.Spec.Networking.Subnets {\n\t\tsubnet := &b.Cluster.Spec.Networking.Subnets[i]\n\t\tsubnetMap[subnet.Name] = subnet\n\t}\n\n\tvar subnetType kops.SubnetType\n\tfor _, subnetName := range ig.Spec.Subnets {\n\t\tsubnet := subnetMap[subnetName]\n\t\tif subnet == nil {\n\t\t\treturn nil, fmt.Errorf(\"SpotInstanceGroup %q uses subnet %q that does not exist\", ig.ObjectMeta.Name, subnetName)\n\t\t}\n\t\tif subnetType != \"\" && subnetType != subnet.Type {\n\t\t\treturn nil, fmt.Errorf(\"SpotInstanceGroup %q cannot be in subnets of different Type\", ig.ObjectMeta.Name)\n\t\t}\n\t\tsubnetType = subnet.Type\n\t}\n\n\tvar associatePublicIP bool\n\tswitch subnetType {\n\tcase kops.SubnetTypePublic, kops.SubnetTypeUtility:\n\t\tassociatePublicIP = true\n\t\tif ig.Spec.AssociatePublicIP != nil {\n\t\t\tassociatePublicIP = *ig.Spec.AssociatePublicIP\n\t\t}\n\tcase kops.SubnetTypeDualStack, kops.SubnetTypePrivate:\n\t\tassociatePublicIP = false\n\t\tif ig.Spec.AssociatePublicIP != nil {\n\t\t\tif *ig.Spec.AssociatePublicIP {","sourceCodeStart":720,"sourceCodeEnd":756,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/spotinst.go#L720-L756","documentation":"Raised by buildPublicIPOpts when a subnet name listed in the SpotInstanceGroup spec cannot be found in the cluster subnet map. kops refuses to guess, because public-IP policy depends on the subnet's type. The message names the IG and the missing subnet.","triggerScenarios":"kops create/update where spec.subnets on the Spotinst instance group contains a name absent from the cluster spec's subnets list (case-sensitive exact match).","commonSituations":"Typos in subnet names, renamed subnets in the cluster spec without updating IGs, or an IG moved between clusters with different subnet naming.","solutions":["Run kops get cluster -o yaml and copy the exact subnet names into the IG spec","Fix the typo in spec.subnets (names are case-sensitive)","If the subnet was removed from the cluster, remove it from the IG too","Re-run kops update --yes"],"exampleFix":"// before\nspec:\n  subnets: [prviate-a]\n// after\nspec:\n  subnets: [private-a]","handlingStrategy":"validation","validationCode":"names := map[string]*kops.Subnet{}\nfor i := range cluster.Spec.Subnets { names[cluster.Spec.Subnets[i].Name] = &cluster.Spec.Subnets[i] }\nfor _, n := range ig.Spec.Subnets {\n  if names[n] == nil {\n    return fmt.Errorf(\"subnet %q referenced by IG %q does not exist\", n, ig.Name)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy subnet names verbatim from kops get cluster -o yaml","Names are case-sensitive; watch for typos","Remove IG references to subnets deleted from the cluster"],"tags":["aws","spotinst","subnets","network"],"backgroundTag":"subnet-not-found","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"}