kubernetes/kops · error

unable to infer any Subnets for InstanceGroup %s

Error message

unable to infer any Subnets for InstanceGroup %s 

What it means

NewCluster validation guard: fires when an instance group ends up with zero subnets after inference from the cluster spec. It fires when cluster networking subnets are missing, all filtered out (utility/dualstack rules), or don't match the instance group's requirements, leaving the group unplaceable.

Source

Thrown at upup/pkg/fi/cloudup/new_cluster.go:604

			if len(ig.Spec.Subnets) == 0 {
				for _, subnet := range cluster.Spec.Networking.Subnets {
					if subnet.Type != api.SubnetTypeDualStack && subnet.Type != api.SubnetTypeUtility {
						g.Spec.Subnets = append(g.Spec.Subnets, subnet.Name)
					}
				}
			}

			if len(g.Spec.Subnets) == 0 {
				for _, subnet := range cluster.Spec.Networking.Subnets {
					if subnet.Type != api.SubnetTypeUtility {
						g.Spec.Subnets = append(g.Spec.Subnets, subnet.Name)
					}
				}
			}
		}

		if len(g.Spec.Subnets) == 0 {
			return nil, fmt.Errorf("unable to infer any Subnets for InstanceGroup %s ", g.ObjectMeta.Name)
		}

		ig.AddInstanceGroupNodeLabel()
	}

	result := NewClusterResult{
		Cluster:        cluster,
		InstanceGroups: instanceGroups,
		Channel:        channel,
	}
	return &result, nil
}

func parseKubernetesFeatureGate(featureGate string) (string, bool, error) {
	featureGate = strings.TrimSpace(featureGate)
	if featureGate == "" {
		return "", false, fmt.Errorf("kubernetes feature gate must not be empty")
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Define spec.networking.subnets in the cluster spec with non-utility subnets
  2. Check that subnet types match the instance group's placement rules
  3. Specify subnets explicitly on the instance group via spec.subnets
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/new_cluster.go:604 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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