kubernetes/kops · error

could not find private subnet in zone: %q

Error message

could not find private subnet in zone: %q

What it means

No subnet of type Private exists in the requested zone; the calling task (e.g. NAT gateway or private route table linkage) requires a private subnet in that zone but the cluster spec defines none.

Source

Thrown at pkg/model/awsmodel/context.go:96

		return nil, fmt.Errorf("found multiple utility subnets in zone: %q", zoneName)
	}

	return b.LinkToSubnet(matches[0]), nil
}
func (b *AWSModelContext) LinkToPrivateSubnetsInZone(zoneName string) ([]*awstasks.Subnet, error) {
	var matches []*kops.ClusterSubnetSpec
	for i := range b.Cluster.Spec.Networking.Subnets {
		s := &b.Cluster.Spec.Networking.Subnets[i]
		if s.Zone != zoneName {
			continue
		}
		if s.Type != kops.SubnetTypePrivate {
			continue
		}
		matches = append(matches, s)
	}
	if len(matches) == 0 {
		return nil, fmt.Errorf("could not find private subnet in zone: %q", zoneName)
	}

	var subnets []*awstasks.Subnet

	for _, match := range matches {
		subnets = append(subnets, b.LinkToSubnet(match))
	}

	return subnets, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Add a private subnet for the zone via kops edit cluster
  2. Review subnet allocation for the zone
  3. Ensure control-plane subnets are typed Private
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/model/awsmodel/context.go:96 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/1151ff964fce8ac2. Report an issue: GitHub.