kubernetes/kops · error

no zones found for instance group %q

Error message

no zones found for instance group %q

What it means

In GetClusterAutoscalerNodeGroups, for GCE autoscaling instance groups, kOps resolves the zones the instance group will span via FindZonesForInstanceGroup. If the resulting zone list is empty, it cannot build per-zone instance group URLs for the autoscaler and returns this error.

Source

Thrown at upup/pkg/fi/cloudup/template_functions.go:1130

	for _, ig := range tf.KopsModelContext.InstanceGroups {
		if ig.Spec.Role.HasNode() && (ig.Spec.Autoscale == nil || fi.ValueOf(ig.Spec.Autoscale)) {
			group := ClusterAutoscalerNodeGroup{
				AutoScale: ig.Spec.Autoscale,
				MinSize:   fi.ValueOf(ig.Spec.MinSize),
				MaxSize:   fi.ValueOf(ig.Spec.MaxSize),
			}
			if cluster.GetCloudProvider() == kops.CloudProviderGCE {
				// On GCE, kOps creates one zonal InstanceGroupManager per zone of the
				// instance group, so each zonal MIG must be registered with
				// cluster-autoscaler as its own node group. The min/max sizes are
				// split across zones the same way the MIG target sizes are.
				cloud := tf.cloud.(gce.GCECloud)
				zones, err := apiModel.FindZonesForInstanceGroup(cluster, ig)
				if err != nil {
					return nil, err
				}
				if len(zones) == 0 {
					return nil, fmt.Errorf("no zones found for instance group %q", ig.ObjectMeta.Name)
				}
				minSizeByZone := gcemodel.SplitCountAcrossZones(int(group.MinSize), zones)
				maxSizeByZone := gcemodel.SplitCountAcrossZones(int(group.MaxSize), zones)
				format := "https://www.googleapis.com/compute/v1/projects/%s/zones/%s/instanceGroups/%s"
				for _, zone := range zones {
					// A zone whose max size is zero can never hold an instance.
					if len(zones) > 1 && maxSizeByZone[zone] == 0 {
						continue
					}
					zoneGroup := group
					zoneGroup.MinSize = int32(minSizeByZone[zone])
					zoneGroup.MaxSize = int32(maxSizeByZone[zone])
					zoneGroup.Other = fmt.Sprintf(format, cloud.Project(), zone, gce.NameForInstanceGroupManager(cluster.ObjectMeta.Name, ig.ObjectMeta.Name, zone))
					key := ig.Name
					if len(zones) > 1 {
						key = ig.Name + "-" + zone
					}
					groups[key] = zoneGroup

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set spec.zones explicitly on the autoscaling instance group.
  2. Verify the cluster's subnets/region resolve to valid GCE zones.
  3. Check that cluster.Spec.Networking/subnet config is consistent with the zones in the cluster spec.
  4. Re-run kops update after fixing the spec.

Example fix

// before
metadata:
  name: nodes
spec:
  autoscale: true
// after
metadata:
  name: nodes
spec:
  autoscale: true
  zones: [us-central1-a, us-central1-b]
Defensive patterns

Strategy: validation

Validate before calling

// Go: ensure autoscaling GCE instance groups define resolvable zones
if fi.ValueOf(ig.Spec.Autoscale) && len(ig.Spec.Zones) == 0 {
    return fmt.Errorf("instance group %q: autoscaling requires explicit spec.zones on GCE", ig.Name)
}

Prevention

When it happens

Trigger: GCE cluster with an autoscaling instance group whose zones resolve to an empty set — typically ig.Spec.Zones empty AND cluster/subnet configuration yields no zones, or FindZonesForInstanceGroup filters everything out.

Common situations: Instance group missing spec.zones on GCE; region/multizone configuration mismatch; cluster spec with subnets that map to no zones; typos in zone names filtered out during resolution.

Related errors


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