kubernetes/kops · error

error assigning default machine type for control plane: %v

Error message

error assigning default machine type for control plane: %v

What it means

When building instance groups, NewCluster fills in a default machine type for control-plane nodes if none was set. If the cloud-specific defaultMachineType() lookup fails (e.g. unsupported zone/region, quota or API error), the failure is wrapped with this message and cluster creation stops.

Source

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

				instanceGroup.Spec.Image = opt.Image
			} else {
				architecture, err := MachineArchitecture(cloud, instanceGroup.Spec.MachineType)
				if err != nil {
					return nil, err
				}
				instanceGroup.Spec.Image, err = defaultImage(cluster, channel, architecture)
				if err != nil {
					return nil, err
				}
			}
		}

		// TODO: Clean up
		if g.IsControlPlane() {
			if g.Spec.MachineType == "" {
				g.Spec.MachineType, err = defaultMachineType(cloud, cluster, ig)
				if err != nil {
					return nil, fmt.Errorf("error assigning default machine type for control plane: %v", err)
				}

			}
		} else if g.Spec.Role.HasBastion() {
			if g.Spec.MachineType == "" {
				g.Spec.MachineType, err = defaultMachineType(cloud, cluster, g)
				if err != nil {
					return nil, fmt.Errorf("error assigning default machine type for bastions: %v", err)
				}
			}
		} else {
			if g.IsAPIServerOnly() && !featureflag.APIServerNodes.Enabled() {
				return nil, fmt.Errorf("apiserver nodes requires the APIServerNodes feature flag to be enabled")
			}
			if !featureflag.ExperimentalRoles.Enabled() {
				switch {
				case g.Spec.Role.HasEtcd():
					return nil, fmt.Errorf("etcd nodes requires the ExperimentalRoles feature flag to be enabled")

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set an explicit machine type on the control-plane instance group so no default lookup is needed: `--control-plane-size=m6i.large` (AWS) or edit the instance group spec.
  2. Verify cloud credentials and permissions used by kops.
  3. Check the wrapped %v cause in the full error output for the underlying API failure and fix that (region, quota, network).
  4. Retry after confirming the zone/region supports the default instance family.

Example fix

// before
kops create cluster --name=example.com --zones=us-east-1a
// after
kops create cluster --name=example.com --zones=us-east-1a --control-plane-size=m6i.large
Defensive patterns

Strategy: validation

Validate before calling

if cpIG.Spec.MachineType == "" {
    // avoid cloud default lookup by setting it explicitly
    cpIG.Spec.MachineType = "m6i.large"
}

Try / catch

cluster, err := NewCluster(opt, cluster, zoneMap)
if err != nil {
    if strings.Contains(err.Error(), "default machine type for control plane") {
        return fmt.Errorf("set --control-plane-size explicitly or fix cloud API access: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: `kops create cluster` with no explicit control-plane machine type while the cloud API call to determine the default fails — bad region, restricted API credentials, unsupported zone, or network failure to the cloud API.

Common situations: Control-plane instance groups defined via `kops create cluster --control-plane-size` omitted and cloudspotting/defaulting runs against an unreachable or misconfigured cloud; IAM credentials lacking EC2/Compute read permissions; region where the default instance family is unavailable.

Related errors


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