kubernetes/kops · error
no zones found in instance groups in cluster %q
Error message
no zones found in instance groups in cluster %q
What it means
After finding instance groups, the command unions ig.Spec.Zones to choose target zones; if all instance groups have empty Zones it returns 'no zones found in instance groups in cluster %q'. The generated MachineDeployment must be placed in at least one zone.
Source
Thrown at pkg/commands/toolbox/clusterapi/generate_machinedeployment.go:167
if len(zones) == 0 || instanceType == "" || image == "" {
instanceGroups, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
if len(instanceGroups.Items) == 0 {
return fmt.Errorf("no instance groups found in cluster %q", options.ClusterName)
}
if len(zones) == 0 {
allZones := sets.New[string]()
for _, ig := range instanceGroups.Items {
for _, z := range ig.Spec.Zones {
allZones.Insert(z)
}
}
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)View on GitHub (pinned to 4c8573c808)
Solutions
- Set zones on each instance group: `kops edit instancegroup nodes` and add spec.zones entries.
- Recreate IGs via `kops update cluster` from a cluster spec with valid zones.
- Verify with `kops get ig -oyaml` that each group lists at least one zone.
Example fix
// before: instance group spec
metadata:
name: nodes
spec: {}
// after
metadata:
name: nodes
spec:
machineType: t3.medium
zones:
- us-east-1a
- us-east-1b Defensive patterns
Strategy: validation
Validate before calling
zones := sets.New[string]()
for _, ig := range igs.Items {
zones.Insert(ig.Spec.Zones...)
}
if zones.Len() == 0 {
return fmt.Errorf("all instance groups lack spec.zones; add zones before generating")
} Type guard
func igHasZones(ig *api.InstanceGroup) bool { return ig != nil && len(ig.Spec.Zones) > 0 } Try / catch
if err := RunGenerateMachineDeployment(ctx, f, out, options); err != nil {
if strings.Contains(err.Error(), "no zones found in instance groups") {
return fmt.Errorf("set spec.zones on instance groups, then retry: %w", err)
}
return err
} Prevention
- Require zones in every IG template used by automation.
- Diff IG YAML after scripted edits to ensure zones weren't dropped.
- Validate IGs (zones present) as a CI preflight for cluster-api workflows.
When it happens
Trigger: All InstanceGroups in the cluster have empty spec.zones — e.g. hand-written IG manifests without zones, or IGs edited to remove zones, while zones were not otherwise derivable.
Common situations: Importing cluster configs without zone fields; editing IGs with a script that drops zones; region-scoped configs intended for a different scheduler.
Related errors
- no instance groups found in cluster %q
- no instance types found in instance groups in cluster %q
- error creating kops config template: %w
- error creating gcp machine template: %w
- error building machine deployments: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/59698f24e1d84e99.
Report an issue: GitHub.