{"record":{"id":"27640c54142f066b","repo":"kubernetes/kops","slug":"no-images-found-in-instance-groups-in-cluster-q","errorCode":null,"errorMessage":"no images found in instance groups in cluster %q","messagePattern":"no images found in instance groups in cluster %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/toolbox/clusterapi/generate_machinedeployment.go","lineNumber":199,"sourceCode":"\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}\n\t\t\tif images.Len() > 1 {\n\t\t\t\tklog.Warningf(\"multiple images found in instance groups in cluster %q; using an arbitrary image\", options.ClusterName)\n\t\t\t}\n\t\t\timage = sets.List(images)[0]\n\t\t\tlog.Info(\"selected image\", \"image\", image)\n\t\t}\n\t}\n\n\tkubernetesVersion := cluster.Spec.KubernetesVersion\n\n\trole := kops.InstanceGroupRoleNode\n\n\tb := &builders.MachineDeploymentBuilder{\n\t\tClusterName:       cluster.GetName(),\n\t\tNamespace:         options.Namespace,\n\t\tName:              options.Name,\n\t\tReplicas:          options.Replicas,","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/commands/toolbox/clusterapi/generate_machinedeployment.go#L181-L217","documentation":"RunGenerateMachineDeployment in `kops toolbox cluster-api machine-deployment` collects the set of `spec.image` values across the cluster's instance groups. If no instance group declares a non-empty image (or there are no instance groups at all), the tool cannot determine which machine image the MachineDeployment should use and fails fast with this error rather than guessing.","triggerScenarios":"Running `kops toolbox cluster-api generate machine-deployment --name <cluster>` against a cluster whose InstanceGroups (as fetched from the kOps state store) all have empty `spec.image` fields, or whose InstanceGroup list is empty.","commonSituations":"Clusters whose instance groups were hand-edited to drop the image field; clusters migrated/managed by an external controller (e.g. Cluster API managed control planes) that leave image unset; fetching instance groups from the wrong cluster name so an empty/unrelated set is returned.","solutions":["Set `spec.image` on every instance group (or at least the ones backing the MachineDeployment) and run `kops update cluster` / `kops replace -f ig.yaml` so the state store has images","Verify --name points at the intended cluster; run `kops get instancegroups <cluster>` to confirm images are present","If the cluster is externally managed, specify the image via the tool's options/flags instead of relying on instance-group inheritance"],"exampleFix":"// before: instance group without image\nspec:\n  machineType: m5.large\n// after\nspec:\n  machineType: m5.large\n  image: ami-0123456789abcdef0","handlingStrategy":"validation","validationCode":"// before running the command\nigs=$(kops get instancegroups --name \"$CLUSTER\" -o json | jq -r '[.items[].spec.image // empty] | unique | length')\n[ \"$igs\" -ge 1 ] || { echo \"no instance group has spec.image set\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set spec.image in every InstanceGroup manifest","Run `kops get instancegroups` before toolbox commands to sanity-check the cluster","Pin the cluster name with KOPS_CLUSTER_NAME to avoid querying the wrong cluster"],"tags":["cli","instance-groups","machine-deployment","cluster-api"],"backgroundTag":"missing-instance-group-image","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}