{"record":{"id":"6b18aad06cca43ac","repo":"kubernetes/kops","slug":"error-assigning-default-machine-type-for-nodes-v","errorCode":null,"errorMessage":"error assigning default machine type for nodes: %v","messagePattern":"error assigning default machine type for nodes: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":556,"sourceCode":"\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\")\n\t\t\t\tcase g.Spec.Role.HasScheduler():\n\t\t\t\t\treturn nil, fmt.Errorf(\"scheduler nodes requires the ExperimentalRoles feature flag to be enabled\")\n\t\t\t\tcase g.Spec.Role.HasKubeControllerManager():\n\t\t\t\t\treturn nil, fmt.Errorf(\"kube-controller-manager nodes requires the ExperimentalRoles feature flag to be enabled\")\n\t\t\t\t}\n\t\t\t}\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 nodes: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif ig.Spec.Tenancy != \"\" && ig.Spec.Tenancy != \"default\" {\n\t\t\tswitch cluster.GetCloudProvider() {\n\t\t\tcase api.CloudProviderAWS:\n\t\t\t\tif _, ok := awsDedicatedInstanceExceptions[g.Spec.MachineType]; ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid dedicated instance type: %s\", g.Spec.MachineType)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tklog.Warning(\"Trying to set tenancy on non-AWS environment\")\n\t\t\t}\n\t\t}\n\n\t\tif ig.IsControlPlane() {\n\t\t\tif len(ig.Spec.Subnets) == 0 {","sourceCodeStart":538,"sourceCodeEnd":574,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L538-L574","documentation":"For non-control-plane, non-bastion groups (worker nodes), NewCluster assigns a default machine type when spec.machineType is empty. If the cloud-specific defaultMachineType() call fails, the error is wrapped with this message and creation aborts.","triggerScenarios":"`kops create cluster` without specifying node size while the cloud API used to determine defaults fails: bad zone, throttling, credential/permission problems, or family unavailable in region.","commonSituations":"Automated provisioning with minimal flags in a fresh region; IAM roles missing ec2:Describe* permissions; network egress to cloud API blocked in CI.","solutions":["Set an explicit node machine type: `--node-size=t3.medium` (AWS) or spec.machineType on node instance groups.","Read the wrapped %v cause and fix the underlying cloud API problem (region, quota, permissions, network).","Retry once the cloud API is reachable and the default family is available in the zone."],"exampleFix":"// before\nkops create cluster --name=example.com --zones=eu-west-1a\n// after\nkops create cluster --name=example.com --zones=eu-west-1a --node-size=t3.medium","handlingStrategy":"validation","validationCode":"if nodeIG.Spec.MachineType == \"\" {\n    nodeIG.Spec.MachineType = \"t3.medium\" // skip cloud default lookup\n}","typeGuard":null,"tryCatchPattern":"_, err := NewCluster(opt, cluster, zoneMap)\nif err != nil {\n    if strings.Contains(err.Error(), \"default machine type for nodes\") {\n        return fmt.Errorf(\"set --node-size explicitly or fix cloud API access: %w\", err)\n    }\n    return err\n}","preventionTips":["Always set --node-size in CI/automation","Ensure cloud API reachability and IAM describe permissions","Prefer instance families supported in all target zones"],"tags":["nodes","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-12T12:17:11.808Z"}