{"record":{"id":"255e80ae08cbab77","repo":"kubernetes/kops","slug":"error-assigning-default-machine-type-for-control-p","errorCode":null,"errorMessage":"error assigning default machine type for control plane: %v","messagePattern":"error assigning default machine type for control plane: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":528,"sourceCode":"\t\t\t\tinstanceGroup.Spec.Image = opt.Image\n\t\t\t} else {\n\t\t\t\tarchitecture, err := MachineArchitecture(cloud, instanceGroup.Spec.MachineType)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tinstanceGroup.Spec.Image, err = defaultImage(cluster, channel, architecture)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// TODO: Clean up\n\t\tif g.IsControlPlane() {\n\t\t\tif g.Spec.MachineType == \"\" {\n\t\t\t\tg.Spec.MachineType, err = defaultMachineType(cloud, cluster, ig)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error assigning default machine type for control plane: %v\", err)\n\t\t\t\t}\n\n\t\t\t}\n\t\t} else if g.Spec.Role.HasBastion() {\n\t\t\tif g.Spec.MachineType == \"\" {\n\t\t\t\tg.Spec.MachineType, err = defaultMachineType(cloud, cluster, g)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error assigning default machine type for bastions: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif g.IsAPIServerOnly() && !featureflag.APIServerNodes.Enabled() {\n\t\t\t\treturn nil, fmt.Errorf(\"apiserver nodes requires the APIServerNodes feature flag to be enabled\")\n\t\t\t}\n\t\t\tif !featureflag.ExperimentalRoles.Enabled() {\n\t\t\t\tswitch {\n\t\t\t\tcase g.Spec.Role.HasEtcd():\n\t\t\t\t\treturn nil, fmt.Errorf(\"etcd nodes requires the ExperimentalRoles feature flag to be enabled\")","sourceCodeStart":510,"sourceCodeEnd":546,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L510-L546","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["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.","Verify cloud credentials and permissions used by kops.","Check the wrapped %v cause in the full error output for the underlying API failure and fix that (region, quota, network).","Retry after confirming the zone/region supports the default instance family."],"exampleFix":"// before\nkops create cluster --name=example.com --zones=us-east-1a\n// after\nkops create cluster --name=example.com --zones=us-east-1a --control-plane-size=m6i.large","handlingStrategy":"validation","validationCode":"if cpIG.Spec.MachineType == \"\" {\n    // avoid cloud default lookup by setting it explicitly\n    cpIG.Spec.MachineType = \"m6i.large\"\n}","typeGuard":null,"tryCatchPattern":"cluster, err := NewCluster(opt, cluster, zoneMap)\nif err != nil {\n    if strings.Contains(err.Error(), \"default machine type for control plane\") {\n        return fmt.Errorf(\"set --control-plane-size explicitly or fix cloud API access: %w\", err)\n    }\n    return err\n}","preventionTips":["Always pass --control-plane-size in automated pipelines","Verify cloud credentials have permission to describe instance types before provisioning","Keep default instance families available in your chosen region"],"tags":["control-plane","machine-type","cloud-api","kops"],"backgroundTag":"default-value-lookup-failed","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"}