{"record":{"id":"5e8231f04e27f558","repo":"kubernetes/kops","slug":"specified-d-control-plane-zones-but-also-request","errorCode":null,"errorMessage":"specified %d control-plane zones, but also requested %d control-plane nodes.  If specifying both, the count should match.","messagePattern":"specified (.+?) control-plane zones, but also requested (.+?) control-plane nodes\\.  If specifying both, the count should match\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":984,"sourceCode":"\t}\n\treturn res, nil\n}\n\nfunc setupControlPlane(opt *NewClusterOptions, cluster *api.Cluster, zoneToSubnetsMap map[string][]*api.ClusterSubnetSpec) ([]*api.InstanceGroup, error) {\n\tcloudProvider := cluster.GetCloudProvider()\n\n\tvar controlPlanes []*api.InstanceGroup\n\n\t// Build the control-plane subnets.\n\t// The control-plane zones is the default set of zones unless explicitly set.\n\t// The control-plane count is the number of control-plane zones unless explicitly set.\n\t// We then round-robin around the zones.\n\t{\n\t\tcontrolPlaneCount := opt.ControlPlaneCount\n\t\tcontrolPlaneZones := opt.ControlPlaneZones\n\t\tif len(controlPlaneZones) != 0 {\n\t\t\tif controlPlaneCount != 0 && controlPlaneCount < int32(len(controlPlaneZones)) {\n\t\t\t\treturn 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)\n\t\t\t}\n\n\t\t\tif controlPlaneCount == 0 {\n\t\t\t\t// If control-plane count is not specified, default to the number of control-plane zones\n\t\t\t\tcontrolPlaneCount = int32(len(controlPlaneZones))\n\t\t\t}\n\t\t} else {\n\t\t\t// controlPlaneZones not set; default to same as node Zones\n\t\t\tcontrolPlaneZones = opt.Zones\n\n\t\t\tif controlPlaneCount == 0 {\n\t\t\t\t// If control-plane count is not specified, default to 1\n\t\t\t\tcontrolPlaneCount = 1\n\t\t\t}\n\t\t}\n\n\t\tif len(controlPlaneZones) == 0 {\n\t\t\t// Should be unreachable","sourceCodeStart":966,"sourceCodeEnd":1002,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L966-L1002","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Set --control-plane-count equal to (or omit it to default to) the number of control-plane zones.","Remove zones from --control-plane-zones until they match the desired count.","If you truly want fewer control-plane machines, reduce both lists/counts together."],"exampleFix":"// before\nkops create cluster my.cluster --control-plane-zones us-east-1a,us-east-1b,us-east-1c --control-plane-count 2\n// after\nkops create cluster my.cluster --control-plane-zones us-east-1a,us-east-1b,us-east-1c --control-plane-count 3","handlingStrategy":"validation","validationCode":"[ ${#CP_ZONES[@]} -le $CP_COUNT ] || { echo \"--control-plane-count must be >= number of --control-plane-zones\"; exit 1; }","typeGuard":null,"tryCatchPattern":"if err := createCluster(); err != nil && strings.Contains(err.Error(), \"the count should match\") { /* align count with zones, retry */ }","preventionTips":["Omit --control-plane-count to default it to the zone count","Compute count from the zone list in scripts","Never shrink control-plane count below the zone count"],"tags":["cli-flags","control-plane","ha","cluster-creation"],"backgroundTag":"flag-count-mismatch","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}