{"record":{"id":"3154d599dd2828d7","repo":"kubernetes/kops","slug":"unable-to-infer-any-subnets-for-instancegroup-s-3154d5","errorCode":null,"errorMessage":"unable to infer any Subnets for InstanceGroup %s ","messagePattern":"unable to infer any Subnets for InstanceGroup (.+?) ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/populate_instancegroup_spec.go","lineNumber":202,"sourceCode":"\t\tif len(ig.Spec.Subnets) == 0 {\n\t\t\tfor _, subnet := range cluster.Spec.Networking.Subnets {\n\t\t\t\tif subnet.Type != kops.SubnetTypeDualStack && subnet.Type != kops.SubnetTypeUtility {\n\t\t\t\t\tig.Spec.Subnets = append(ig.Spec.Subnets, subnet.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif len(ig.Spec.Subnets) == 0 {\n\t\t\tfor _, subnet := range cluster.Spec.Networking.Subnets {\n\t\t\t\tif subnet.Type != kops.SubnetTypeUtility {\n\t\t\t\t\tig.Spec.Subnets = append(ig.Spec.Subnets, subnet.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(ig.Spec.Subnets) == 0 {\n\t\treturn nil, fmt.Errorf(\"unable to infer any Subnets for InstanceGroup %s \", ig.ObjectMeta.Name)\n\t}\n\n\thasGPU := false\n\tclusterNvidia := cluster.Spec.Containerd != nil && cluster.Spec.Containerd.NvidiaGPU != nil && fi.ValueOf(cluster.Spec.Containerd.NvidiaGPU.Enabled)\n\tigNvidia := ig.Spec.Containerd != nil && ig.Spec.Containerd.NvidiaGPU != nil && fi.ValueOf(ig.Spec.Containerd.NvidiaGPU.Enabled)\n\n\tswitch cluster.GetCloudProvider() {\n\tcase kops.CloudProviderAWS:\n\t\tif clusterNvidia || igNvidia {\n\t\t\tmt, err := awsup.GetMachineTypeInfo(cloud.(awsup.AWSCloud), ec2types.InstanceType(ig.Spec.MachineType))\n\t\t\tif err != nil {\n\t\t\t\treturn ig, fmt.Errorf(\"error looking up machine type info: %v\", err)\n\t\t\t}\n\t\t\thasGPU = mt.GPU\n\t\t}\n\tcase kops.CloudProviderOpenstack:\n\t\tif igNvidia {\n\t\t\thasGPU = true","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/populate_instancegroup_spec.go#L184-L220","documentation":"After the API-server-only IPv6 fallback tries to infer subnets from the cluster spec, if spec.subnets is still empty kOps cannot determine where to place the InstanceGroup's machines and returns this error.","triggerScenarios":"Any InstanceGroup (node, bastion, apiserver-only) with empty spec.subnets where inference fails: the cluster has no non-private/non-utility subnets for the IPv6 fallback, or the group isn't eligible for inference at all.","commonSituations":"Node InstanceGroups created without --subnet on clusters where defaults can't be inferred; IPv6-only clusters whose only subnets are private/utility; bastion groups defined without subnets.","solutions":["Set spec.subnets explicitly on the InstanceGroup","For IPv6-only clusters, add public (non-private/utility) subnets to cluster.spec.networking.subnets so inference can succeed","Recreate the group with --subnet: `kops create instancegroup nodes --subnet us-east-1a`"],"exampleFix":"// before\nspec:\n  role: Node\n// after\nspec:\n  role: Node\n  subnets:\n  - us-east-1a\n  - us-east-1b","handlingStrategy":"validation","validationCode":"// Require subnets on every instance group before populating\nfor _, ig := range instanceGroups {\n    if len(ig.Spec.Subnets) == 0 {\n        return fmt.Errorf(\"instance group %s: set spec.subnets\", ig.ObjectMeta.Name)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set spec.subnets on all InstanceGroups explicitly","For IPv6-only clusters, keep at least one public subnet in the cluster spec","Validate manifests with `kops update cluster --dry-run` in CI"],"tags":["kops","subnets","instancegroup","validation"],"backgroundTag":"missing-subnet-configuration","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"}