kubernetes/kops · error
no images found in instance groups in cluster %q
Error message
no images found in instance groups in cluster %q
What it means
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.
Source
Thrown at pkg/commands/toolbox/clusterapi/generate_machinedeployment.go:199
if instanceTypes.Len() == 0 {
return fmt.Errorf("no instance types found in instance groups in cluster %q", options.ClusterName)
}
if instanceTypes.Len() > 1 {
klog.Warningf("multiple instance types found in instance groups in cluster %q; using an arbitrary instance type", options.ClusterName)
}
instanceType = sets.List(instanceTypes)[0]
log.Info("selected instance type", "instanceType", instanceType)
}
if image == "" {
images := sets.New[string]()
for _, ig := range instanceGroups.Items {
if ig.Spec.Image != "" {
images.Insert(ig.Spec.Image)
}
}
if images.Len() == 0 {
return fmt.Errorf("no images found in instance groups in cluster %q", options.ClusterName)
}
if images.Len() > 1 {
klog.Warningf("multiple images found in instance groups in cluster %q; using an arbitrary image", options.ClusterName)
}
image = sets.List(images)[0]
log.Info("selected image", "image", image)
}
}
kubernetesVersion := cluster.Spec.KubernetesVersion
role := kops.InstanceGroupRoleNode
b := &builders.MachineDeploymentBuilder{
ClusterName: cluster.GetName(),
Namespace: options.Namespace,
Name: options.Name,
Replicas: options.Replicas,View on GitHub (pinned to 4c8573c808)
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
Example fix
// before: instance group without image spec: machineType: m5.large // after spec: machineType: m5.large image: ami-0123456789abcdef0
Defensive patterns
Strategy: validation
Validate before calling
// before running the command
igs=$(kops get instancegroups --name "$CLUSTER" -o json | jq -r '[.items[].spec.image // empty] | unique | length')
[ "$igs" -ge 1 ] || { echo "no instance group has spec.image set"; exit 1; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- error building machine deployments: %w
- could not find instance %v
- no instance groups found in cluster %q
- no zones found in instance groups in cluster %q
- no instance types found in instance groups in cluster %q
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/27640c54142f066b.
Report an issue: GitHub.