{"record":{"id":"f93fb99522b12715","repo":"kubernetes/kops","slug":"error-assigning-default-machine-type-for-nodes-v-f93fb9","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/populate_instancegroup_spec.go","lineNumber":136,"sourceCode":"\t\t}\n\t} else {\n\t\tif ig.IsAPIServerOnly() && !featureflag.APIServerNodes.Enabled() {\n\t\t\treturn nil, fmt.Errorf(\"apiserver nodes requires the APIServerNodes feature flag to be enabled\")\n\t\t}\n\t\tif !featureflag.ExperimentalRoles.Enabled() {\n\t\t\tswitch {\n\t\t\tcase ig.Spec.Role.HasEtcd():\n\t\t\t\treturn nil, fmt.Errorf(\"etcd nodes requires the ExperimentalNodes feature flag to be enabled\")\n\t\t\tcase ig.Spec.Role.HasScheduler():\n\t\t\t\treturn nil, fmt.Errorf(\"scheduler nodes requires the ExperimentalNodes feature flag to be enabled\")\n\t\t\tcase ig.Spec.Role.HasKubeControllerManager():\n\t\t\t\treturn nil, fmt.Errorf(\"kube-controller-manager nodes requires the ExperimentalNodes feature flag to be enabled\")\n\t\t\t}\n\t\t}\n\t\tif ig.Spec.MachineType == \"\" {\n\t\t\tig.Spec.MachineType, err = defaultMachineType(cloud, cluster, ig)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error assigning default machine type for nodes: %v\", err)\n\t\t\t}\n\t\t}\n\t\tif ig.Spec.Manager != kops.InstanceManagerKarpenter {\n\t\t\tif ig.Spec.MinSize == nil {\n\t\t\t\tig.Spec.MinSize = new(int32(2))\n\t\t\t}\n\t\t\tif ig.Spec.MaxSize == nil {\n\t\t\t\tig.Spec.MaxSize = new(int32(2))\n\t\t\t}\n\t\t}\n\t}\n\n\tif ig.Spec.Image == \"\" {\n\t\tarchitecture, err := MachineArchitecture(cloud, ig.Spec.MachineType)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to determine machine architecture for InstanceGroup %q: %v\", ig.ObjectMeta.Name, err)\n\t\t}\n\t\tig.Spec.Image, err = defaultImage(cluster, channel, architecture)","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/populate_instancegroup_spec.go#L118-L154","documentation":"PopulateInstanceGroupSpec fills in defaults for an InstanceGroup during cluster/instance-group creation. When ig.Spec.MachineType is empty it calls defaultMachineType(cloud, cluster, ig); this error wraps any failure from that per-cloud default lookup. It means kOps could not choose a machine/flavor for the nodes role.","triggerScenarios":"Running `kops create cluster` or `kops create instancegroup` (or `kops toolbox instance-selector`) without --set spec.machineType, while the cloud-specific default lookup fails — e.g. AWS DefaultInstanceType cannot find a valid instance type in the region, or Openstack DefaultInstanceType cannot match a flavor.","commonSituations":"New/unsupported AWS region lacking the default instance types; GCE/AWS quota issues; OpenStack flavor discovery failing due to misconfigured cloud credentials; clusters created with images/instance types deprecated in newer kOps versions.","solutions":["Set spec.machineType explicitly on the InstanceGroup so no default lookup is needed","Verify cloud credentials/permissions allow describing instance types or flavors","Check the wrapped error: if it names a missing/deprecated instance type, pick an available one in your region","Upgrade kOps if the region or machine family is newer than the kOps release"],"exampleFix":"// before\napiVersion: kops.k8s.io/v1alpha2\nkind: InstanceGroup\nmetadata:\n  name: nodes\nspec:\n  role: Node\n// after\nspec:\n  role: Node\n  machineType: t3.medium","handlingStrategy":"validation","validationCode":"// Go: ensure machineType set before calling PopulateInstanceGroupSpec\nif ig.Spec.MachineType == \"\" {\n    ig.Spec.MachineType = os.Getenv(\"KOPS_DEFAULT_MACHINE_TYPE\") // or a known-good per-region type\n}\nif ig.Spec.MachineType == \"\" {\n    return fmt.Errorf(\"instance group %s must set spec.machineType\", ig.Name)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pin machineType in InstanceGroup manifests for production","Test `kops create cluster --dry-run` in new regions before real runs","Keep kOps updated for new region/family support"],"tags":["kops","instancegroup","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"}