{"record":{"id":"1e20583c9c285228","repo":"kubernetes/kops","slug":"expected-exactly-one-subnet-for-instancegroup-q","errorCode":null,"errorMessage":"expected exactly one subnet for InstanceGroup %q; subnets was %s","messagePattern":"expected exactly one subnet for InstanceGroup %q; subnets was (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/azuremodel/api_loadbalancer.go","lineNumber":143,"sourceCode":"\t\t\tLoadDistribution:     network.LoadDistributionDefault,\n\t\t})\n\t}\n\n\tc.AddTask(lb)\n\n\treturn nil\n}\n\n// subnetForLoadBalancer returns the subnet the loadbalancer will use.\nfunc (c *AzureModelContext) subnetForLoadBalancer() (*kops.ClusterSubnetSpec, error) {\n\t// Get all master instance group subnets\n\tfor _, ig := range c.MasterInstanceGroups() {\n\t\tsubnets, err := c.GatherSubnets(ig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(subnets) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"expected exactly one subnet for InstanceGroup %q; subnets was %s\", ig.Name, ig.Spec.Subnets)\n\t\t}\n\t\tif subnets[0].Type != kops.SubnetTypeDualStack && subnets[0].Type != kops.SubnetTypePrivate {\n\t\t\tcontinue\n\t\t}\n\t\treturn subnets[0], nil\n\t}\n\n\treturn nil, fmt.Errorf(\"no suitable subnets found\")\n}\n","sourceCodeStart":125,"sourceCodeEnd":153,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/azuremodel/api_loadbalancer.go#L125-L153","documentation":"A control-plane instance group resolved to zero or multiple subnets; the Azure load balancer subnet picker requires exactly one subnet per master instance group to choose the LB subnet, so the IG's spec.subnets list is the input at fault.","triggerScenarios":"Thrown at pkg/model/azuremodel/api_loadbalancer.go:143 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Edit the instance group so spec.subnets names exactly one subnet","Check the subnet names match those defined in the cluster spec","Re-run kops update"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}