kubernetes/kops · error

expected exactly one subnet for InstanceGroup %q; subnets wa

Error message

expected exactly one subnet for InstanceGroup %q; subnets was %s

What it means

A control-plane instance group resolved to zero or multiple subnets; the Azure load balancer subnet picker requires exactly one subnet per master instance group to choose the LB subnet, so the IG's spec.subnets list is the input at fault.

Source

Thrown at pkg/model/azuremodel/api_loadbalancer.go:143

			LoadDistribution:     network.LoadDistributionDefault,
		})
	}

	c.AddTask(lb)

	return nil
}

// subnetForLoadBalancer returns the subnet the loadbalancer will use.
func (c *AzureModelContext) subnetForLoadBalancer() (*kops.ClusterSubnetSpec, error) {
	// Get all master instance group subnets
	for _, ig := range c.MasterInstanceGroups() {
		subnets, err := c.GatherSubnets(ig)
		if err != nil {
			return nil, err
		}
		if len(subnets) != 1 {
			return nil, fmt.Errorf("expected exactly one subnet for InstanceGroup %q; subnets was %s", ig.Name, ig.Spec.Subnets)
		}
		if subnets[0].Type != kops.SubnetTypeDualStack && subnets[0].Type != kops.SubnetTypePrivate {
			continue
		}
		return subnets[0], nil
	}

	return nil, fmt.Errorf("no suitable subnets found")
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Edit the instance group so spec.subnets names exactly one subnet
  2. Check the subnet names match those defined in the cluster spec
  3. Re-run kops update
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/model/azuremodel/api_loadbalancer.go:143 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/1e20583c9c285228. Report an issue: GitHub.