{"record":{"id":"49d79551b8f62002","repo":"kubernetes/kops","slug":"unexpected-subnet-type-for-instancegroup-q-type","errorCode":null,"errorMessage":"unexpected subnet type: for InstanceGroup %q; type was %s","messagePattern":"unexpected subnet type: for InstanceGroup %q; type was (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/azuremodel/vmscaleset.go","lineNumber":170,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(subnets) != 1 {\n\t\treturn nil, fmt.Errorf(\"expected exactly one subnet for InstanceGroup %q; subnets was %s\", ig.Name, ig.Spec.Subnets)\n\t}\n\tsubnet := subnets[0]\n\tt.Subnet = b.LinkToAzureSubnet(subnet)\n\n\tswitch subnet.Type {\n\tcase kops.SubnetTypePublic, kops.SubnetTypeUtility:\n\t\tt.RequirePublicIP = new(true)\n\t\tif ig.Spec.AssociatePublicIP != nil {\n\t\t\tt.RequirePublicIP = ig.Spec.AssociatePublicIP\n\t\t}\n\tcase kops.SubnetTypeDualStack, kops.SubnetTypePrivate:\n\t\tt.RequirePublicIP = new(false)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unexpected subnet type: for InstanceGroup %q; type was %s\", ig.Name, subnet.Type)\n\t}\n\n\tif ig.Spec.Role.HasControlPlane() && b.Cluster.Spec.API.LoadBalancer != nil {\n\t\tt.LoadBalancer = &azuretasks.LoadBalancer{\n\t\t\tName: to.Ptr(b.NameForLoadBalancer()),\n\t\t}\n\t}\n\n\tt.Tags = b.CloudTagsForInstanceGroup(ig)\n\n\treturn t, nil\n}\n\nfunc getCapacity(spec *kops.InstanceGroupSpec) (*int64, error) {\n\t// Follow the convention that all other CSPs have.\n\tminSize := int32(1)\n\tmaxSize := int32(1)\n\tif spec.MinSize != nil {","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/azuremodel/vmscaleset.go#L152-L188","documentation":"buildVMScaleSetTask switches on the resolved subnet's Type (Public/Utility, DualStack, Private) to configure whether the scale set requires a public IP. Any other subnet type reaches the default branch and aborts model building with this error.","triggerScenarios":"An InstanceGroup on Azure references a subnet whose spec.type is an unrecognized/unset value (e.g. empty string, or a type only valid on other clouds).","commonSituations":"Subnet type omitted in cluster spec; hand-edited cluster.yaml introducing an invalid type; using a subnet type added by a newer kops version with an older binary (or vice versa).","solutions":["Set spec.type of the referenced subnet to one of Public, Utility, DualStack, or Private in the cluster spec.","Upgrade kops to a version that recognizes the configured subnet type.","Re-run `kops get cluster -o yaml` and fix any manually edited subnet entries, then `kops update cluster`."],"exampleFix":"// before (cluster spec subnet)\ntype: \"\"\n// after\ntype: Private","handlingStrategy":"validation","validationCode":"valid := map[kops.SubnetType]bool{kops.SubnetTypePublic: true, kops.SubnetTypeUtility: true, kops.SubnetTypeDualStack: true, kops.SubnetTypePrivate: true}\nfor _, s := range cluster.Spec.Subnets {\n  if !valid[s.Type] {\n    return fmt.Errorf(\"subnet %q has unsupported type %q\", s.Name, s.Type)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set an explicit, supported subnet type in the cluster spec.","Use `kops create cluster` defaults instead of hand-writing subnet entries.","Keep kops binary and cluster spec versions in sync."],"tags":["azure","subnet","vmss","configuration"],"backgroundTag":"unexpected-subnet-type","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"}