kubernetes/kops · error

no instance types found in instance groups in cluster %q

Error message

no instance types found in instance groups in cluster %q

What it means

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.

Source

Thrown at pkg/commands/toolbox/clusterapi/generate_machinedeployment.go:182

				}
			}
			if allZones.Len() == 0 {
				return fmt.Errorf("no zones found in instance groups in cluster %q", options.ClusterName)
			}

			zones = sets.List(allZones)
			log.Info("selected zones", "zones", zones)
		}

		if instanceType == "" {
			instanceTypes := sets.New[string]()
			for _, ig := range instanceGroups.Items {
				if ig.Spec.MachineType != "" {
					instanceTypes.Insert(ig.Spec.MachineType)
				}
			}
			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)
			}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set spec.machineType on instance groups (e.g. t3.medium) via `kops edit instancegroup nodes`, then rerun the generator.
  2. Use --set spec.machineType=... or regenerate IGs from `kops update cluster` output.
  3. Pick a machine type valid for the cluster's region/zone if the field was removed intentionally.

Example fix

// before
spec:
  zones:
  - us-east-1a
// after
spec:
  machineType: t3.medium
  zones:
  - us-east-1a
Defensive patterns

Strategy: validation

Validate before calling

types := sets.New[string]()
for _, ig := range igs.Items {
	if ig.Spec.MachineType != "" {
		types.Insert(ig.Spec.MachineType)
	}
}
if types.Len() == 0 {
	return fmt.Errorf("no instance group sets spec.machineType; set machineType before generating")
}

Type guard

func igHasMachineType(ig *api.InstanceGroup) bool { return ig != nil && ig.Spec.MachineType != "" }

Try / catch

if err := RunGenerateMachineDeployment(ctx, f, out, options); err != nil {
	if strings.Contains(err.Error(), "no instance types found in instance groups") {
		return fmt.Errorf("set spec.machineType on at least one instance group, then retry: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/588ac714c31335a9. Report an issue: GitHub.