{"record":{"id":"588ac714c31335a9","repo":"kubernetes/kops","slug":"no-instance-types-found-in-instance-groups-in-clus","errorCode":null,"errorMessage":"no instance types found in instance groups in cluster %q","messagePattern":"no instance types found in instance groups in cluster %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/toolbox/clusterapi/generate_machinedeployment.go","lineNumber":182,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\t\t\tif allZones.Len() == 0 {\n\t\t\t\treturn fmt.Errorf(\"no zones found in instance groups in cluster %q\", options.ClusterName)\n\t\t\t}\n\n\t\t\tzones = sets.List(allZones)\n\t\t\tlog.Info(\"selected zones\", \"zones\", zones)\n\t\t}\n\n\t\tif instanceType == \"\" {\n\t\t\tinstanceTypes := sets.New[string]()\n\t\t\tfor _, ig := range instanceGroups.Items {\n\t\t\t\tif ig.Spec.MachineType != \"\" {\n\t\t\t\t\tinstanceTypes.Insert(ig.Spec.MachineType)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif instanceTypes.Len() == 0 {\n\t\t\t\treturn fmt.Errorf(\"no instance types found in instance groups in cluster %q\", options.ClusterName)\n\t\t\t}\n\t\t\tif instanceTypes.Len() > 1 {\n\t\t\t\tklog.Warningf(\"multiple instance types found in instance groups in cluster %q; using an arbitrary instance type\", options.ClusterName)\n\t\t\t}\n\t\t\tinstanceType = sets.List(instanceTypes)[0]\n\t\t\tlog.Info(\"selected instance type\", \"instanceType\", instanceType)\n\t\t}\n\n\t\tif image == \"\" {\n\t\t\timages := sets.New[string]()\n\t\t\tfor _, ig := range instanceGroups.Items {\n\t\t\t\tif ig.Spec.Image != \"\" {\n\t\t\t\t\timages.Insert(ig.Spec.Image)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif images.Len() == 0 {\n\t\t\t\treturn fmt.Errorf(\"no images found in instance groups in cluster %q\", options.ClusterName)\n\t\t\t}","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/commands/toolbox/clusterapi/generate_machinedeployment.go#L164-L200","documentation":"The command collects ig.Spec.MachineType values to pick an instance type for the MachineDeployment; if no instance group defines a non-empty MachineType it returns 'no instance types found in instance groups in cluster %q'. Without a machine type it cannot size the generated machines.","triggerScenarios":"All InstanceGroups in the cluster have an empty spec.machineType — typically hand-authored IG YAML omitting machineType, or IGs produced by tooling that leaves sizing to defaults.","commonSituations":"Template-based IG creation that skips machine sizing; editing IGs to remove machineType expecting the cloud provider default; cluster-api workflows where sizing lives elsewhere.","solutions":["Set spec.machineType on instance groups (e.g. t3.medium) via `kops edit instancegroup nodes`, then rerun the generator.","Use --set spec.machineType=... or regenerate IGs from `kops update cluster` output.","Pick a machine type valid for the cluster's region/zone if the field was removed intentionally."],"exampleFix":"// before\nspec:\n  zones:\n  - us-east-1a\n// after\nspec:\n  machineType: t3.medium\n  zones:\n  - us-east-1a","handlingStrategy":"validation","validationCode":"types := sets.New[string]()\nfor _, ig := range igs.Items {\n\tif ig.Spec.MachineType != \"\" {\n\t\ttypes.Insert(ig.Spec.MachineType)\n\t}\n}\nif types.Len() == 0 {\n\treturn fmt.Errorf(\"no instance group sets spec.machineType; set machineType before generating\")\n}","typeGuard":"func igHasMachineType(ig *api.InstanceGroup) bool { return ig != nil && ig.Spec.MachineType != \"\" }","tryCatchPattern":"if err := RunGenerateMachineDeployment(ctx, f, out, options); err != nil {\n\tif strings.Contains(err.Error(), \"no instance types found in instance groups\") {\n\t\treturn fmt.Errorf(\"set spec.machineType on at least one instance group, then retry: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Always populate spec.machineType in IG templates.","Use --set spec.machineType=... or kops edit ig when sizing is missing.","Add a lint step validating IG specs (machineType, zones) before cluster-api generation.","Keep the machine type valid for the cluster's region to avoid follow-on cloud errors."],"tags":["kops","cluster-api","instance-types","instance-groups"],"backgroundTag":"empty-instance-groups","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"}