kubernetes/kops · error

specified %d control-plane zones, but also requested %d cont

Error message

specified %d control-plane zones, but also requested %d control-plane nodes.  If specifying both, the count should match.

What it means

During control-plane instance-group construction, if the user explicitly supplies both --control-plane-zones and --control-plane-count, the count must not be smaller than the number of zones. Each zone must host at least one control-plane node under kops' round-robin placement, so an undersized count is rejected.

Source

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

	}
	return res, nil
}

func setupControlPlane(opt *NewClusterOptions, cluster *api.Cluster, zoneToSubnetsMap map[string][]*api.ClusterSubnetSpec) ([]*api.InstanceGroup, error) {
	cloudProvider := cluster.GetCloudProvider()

	var controlPlanes []*api.InstanceGroup

	// Build the control-plane subnets.
	// The control-plane zones is the default set of zones unless explicitly set.
	// The control-plane count is the number of control-plane zones unless explicitly set.
	// We then round-robin around the zones.
	{
		controlPlaneCount := opt.ControlPlaneCount
		controlPlaneZones := opt.ControlPlaneZones
		if len(controlPlaneZones) != 0 {
			if controlPlaneCount != 0 && controlPlaneCount < int32(len(controlPlaneZones)) {
				return nil, fmt.Errorf("specified %d control-plane zones, but also requested %d control-plane nodes.  If specifying both, the count should match.", len(controlPlaneZones), controlPlaneCount)
			}

			if controlPlaneCount == 0 {
				// If control-plane count is not specified, default to the number of control-plane zones
				controlPlaneCount = int32(len(controlPlaneZones))
			}
		} else {
			// controlPlaneZones not set; default to same as node Zones
			controlPlaneZones = opt.Zones

			if controlPlaneCount == 0 {
				// If control-plane count is not specified, default to 1
				controlPlaneCount = 1
			}
		}

		if len(controlPlaneZones) == 0 {
			// Should be unreachable

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set --control-plane-count equal to (or omit it to default to) the number of control-plane zones.
  2. Remove zones from --control-plane-zones until they match the desired count.
  3. If you truly want fewer control-plane machines, reduce both lists/counts together.

Example fix

// before
kops create cluster my.cluster --control-plane-zones us-east-1a,us-east-1b,us-east-1c --control-plane-count 2
// after
kops create cluster my.cluster --control-plane-zones us-east-1a,us-east-1b,us-east-1c --control-plane-count 3
Defensive patterns

Strategy: validation

Validate before calling

[ ${#CP_ZONES[@]} -le $CP_COUNT ] || { echo "--control-plane-count must be >= number of --control-plane-zones"; exit 1; }

Try / catch

if err := createCluster(); err != nil && strings.Contains(err.Error(), "the count should match") { /* align count with zones, retry */ }

Prevention

When it happens

Trigger: `kops create cluster --zones ... --control-plane-zones a,b,c --control-plane-count 2` (or any count >0 and < len(zones)) calls setupControlPlane from NewCluster and fails.

Common situations: Scaling down a cluster by lowering --control-plane-count while still passing many control-plane zones; copying a command template and editing the count but not the zone list; assuming count < zones is allowed like node counts.

Related errors


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