{"record":{"id":"2a5ac0259a505303","repo":"kubernetes/kops","slug":"error-finding-default-machine-type-v","errorCode":null,"errorMessage":"error finding default machine type: %v","messagePattern":"error finding default machine type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/populate_instancegroup_spec.go","lineNumber":336,"sourceCode":"\t\tigKubeletConfig.AnonymousAuth = new(false)\n\t}\n\n\tig.Spec.Kubelet = igKubeletConfig\n\n\treturn ig, nil\n}\n\n// defaultMachineType returns the default MachineType for the instance group, based on the cloudprovider\nfunc defaultMachineType(cloud fi.Cloud, cluster *kops.Cluster, ig *kops.InstanceGroup) (string, error) {\n\tswitch cluster.GetCloudProvider() {\n\tcase kops.CloudProviderAWS:\n\t\tif ig.Spec.Manager == kops.InstanceManagerKarpenter {\n\t\t\treturn \"\", nil\n\t\t}\n\n\t\tinstanceType, err := cloud.(awsup.AWSCloud).DefaultInstanceType(cluster, ig)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"error finding default machine type: %v\", err)\n\t\t}\n\t\treturn instanceType, nil\n\n\tcase kops.CloudProviderGCE:\n\t\tswitch {\n\t\tcase ig.Spec.Role.HasControlPlane():\n\t\t\treturn defaultMasterMachineTypeGCE, nil\n\n\t\tcase ig.Spec.Role.HasNode():\n\t\t\treturn defaultNodeMachineTypeGCE, nil\n\n\t\tcase ig.Spec.Role.HasBastion():\n\t\t\treturn defaultBastionMachineTypeGCE, nil\n\t\t}\n\n\tcase kops.CloudProviderDO:\n\t\tswitch {\n\t\tcase ig.Spec.Role.HasControlPlane():","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/populate_instancegroup_spec.go#L318-L354","documentation":"defaultMachineType for AWS delegates to awsup.AWSCloud.DefaultInstanceType(cluster, ig), which probes the region for a suitable default instance type. This error wraps its failure when no default could be determined for the AWS cloud.","triggerScenarios":"PopulateInstanceGroupSpec (or NewCluster) with an empty machineType on AWS, where DefaultInstanceType fails — e.g. it can't validate candidate instance types against the region (EC2 API failure), or the IG role/bastion defaults are unavailable in the region.","commonSituations":"AWS regions where the built-in default candidates (e.g. t3.medium) aren't offered (opt-in regions); EC2 API credential/throttling problems; very old kOps defaults retired by AWS; control-plane defaults blocked by regional availability.","solutions":["Set spec.machineType explicitly on the InstanceGroup","Confirm the region supports the candidate defaults (try `aws ec2 describe-instance-type-offerings --region <region>`)","Check AWS credentials and EC2 API access from the machine running kOps","Upgrade kOps so defaults match current AWS offerings"],"exampleFix":"// before\nkops create cluster ... --zones us-east-1a\n// after\nkops create cluster ... --zones us-east-1a --set spec.nodes.machineType=m5.large","handlingStrategy":"validation","validationCode":"// Ensure a machineType is set for AWS IGs to skip DefaultInstanceType entirely\nif cluster.GetCloudProvider() == kops.CloudProviderAWS && ig.Spec.MachineType == \"\" {\n    ig.Spec.MachineType = \"t3.medium\" // node default; use m5.large/c5.large for control-plane\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass --set spec.nodes.machineType=... on create cluster for reproducibility","Confirm region availability of instance types with the AWS CLI before creating clusters","Keep AWS credentials valid where kOps runs (DefaultInstanceType queries EC2)","Prefer modern families (t3/m5) that exist in all commercial regions"],"tags":["kops","aws","machine-type","defaulting"],"backgroundTag":"default-machine-type-resolution-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"}