kubernetes/kops · error
error assigning default machine type for nodes: %v
Error message
error assigning default machine type for nodes: %v
What it means
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.
Source
Thrown at upup/pkg/fi/cloudup/populate_instancegroup_spec.go:136
}
} else {
if ig.IsAPIServerOnly() && !featureflag.APIServerNodes.Enabled() {
return nil, fmt.Errorf("apiserver nodes requires the APIServerNodes feature flag to be enabled")
}
if !featureflag.ExperimentalRoles.Enabled() {
switch {
case ig.Spec.Role.HasEtcd():
return nil, fmt.Errorf("etcd nodes requires the ExperimentalNodes feature flag to be enabled")
case ig.Spec.Role.HasScheduler():
return nil, fmt.Errorf("scheduler nodes requires the ExperimentalNodes feature flag to be enabled")
case ig.Spec.Role.HasKubeControllerManager():
return nil, fmt.Errorf("kube-controller-manager nodes requires the ExperimentalNodes feature flag to be enabled")
}
}
if ig.Spec.MachineType == "" {
ig.Spec.MachineType, err = defaultMachineType(cloud, cluster, ig)
if err != nil {
return nil, fmt.Errorf("error assigning default machine type for nodes: %v", err)
}
}
if ig.Spec.Manager != kops.InstanceManagerKarpenter {
if ig.Spec.MinSize == nil {
ig.Spec.MinSize = new(int32(2))
}
if ig.Spec.MaxSize == nil {
ig.Spec.MaxSize = new(int32(2))
}
}
}
if ig.Spec.Image == "" {
architecture, err := MachineArchitecture(cloud, ig.Spec.MachineType)
if err != nil {
return nil, fmt.Errorf("unable to determine machine architecture for InstanceGroup %q: %v", ig.ObjectMeta.Name, err)
}
ig.Spec.Image, err = defaultImage(cluster, channel, architecture)View on GitHub (pinned to 4c8573c808)
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
Example fix
// before apiVersion: kops.k8s.io/v1alpha2 kind: InstanceGroup metadata: name: nodes spec: role: Node // after spec: role: Node machineType: t3.medium
Defensive patterns
Strategy: validation
Validate before calling
// Go: ensure machineType set before calling PopulateInstanceGroupSpec
if ig.Spec.MachineType == "" {
ig.Spec.MachineType = os.Getenv("KOPS_DEFAULT_MACHINE_TYPE") // or a known-good per-region type
}
if ig.Spec.MachineType == "" {
return fmt.Errorf("instance group %s must set spec.machineType", ig.Name)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- error finding default machine type: %v
- did not find owner for node %q
- invalid InstanceGroup name: %v
- error building InstanceGroup from CAPI Machine: %w
- must specify %q label with cluster name to create instanceGr
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/f93fb99522b12715.
Report an issue: GitHub.