kubernetes/kops · error

error finding default machine type: %v

Error message

error finding default machine type: %v

What it means

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.

Source

Thrown at upup/pkg/fi/cloudup/populate_instancegroup_spec.go:336

		igKubeletConfig.AnonymousAuth = new(false)
	}

	ig.Spec.Kubelet = igKubeletConfig

	return ig, nil
}

// defaultMachineType returns the default MachineType for the instance group, based on the cloudprovider
func defaultMachineType(cloud fi.Cloud, cluster *kops.Cluster, ig *kops.InstanceGroup) (string, error) {
	switch cluster.GetCloudProvider() {
	case kops.CloudProviderAWS:
		if ig.Spec.Manager == kops.InstanceManagerKarpenter {
			return "", nil
		}

		instanceType, err := cloud.(awsup.AWSCloud).DefaultInstanceType(cluster, ig)
		if err != nil {
			return "", fmt.Errorf("error finding default machine type: %v", err)
		}
		return instanceType, nil

	case kops.CloudProviderGCE:
		switch {
		case ig.Spec.Role.HasControlPlane():
			return defaultMasterMachineTypeGCE, nil

		case ig.Spec.Role.HasNode():
			return defaultNodeMachineTypeGCE, nil

		case ig.Spec.Role.HasBastion():
			return defaultBastionMachineTypeGCE, nil
		}

	case kops.CloudProviderDO:
		switch {
		case ig.Spec.Role.HasControlPlane():

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set spec.machineType explicitly on the InstanceGroup
  2. Confirm the region supports the candidate defaults (try `aws ec2 describe-instance-type-offerings --region <region>`)
  3. Check AWS credentials and EC2 API access from the machine running kOps
  4. Upgrade kOps so defaults match current AWS offerings

Example fix

// before
kops create cluster ... --zones us-east-1a
// after
kops create cluster ... --zones us-east-1a --set spec.nodes.machineType=m5.large
Defensive patterns

Strategy: validation

Validate before calling

// Ensure a machineType is set for AWS IGs to skip DefaultInstanceType entirely
if cluster.GetCloudProvider() == kops.CloudProviderAWS && ig.Spec.MachineType == "" {
    ig.Spec.MachineType = "t3.medium" // node default; use m5.large/c5.large for control-plane
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/2a5ac0259a505303. Report an issue: GitHub.