kubernetes/kops · error

invalid dedicated instance type: %s

Error message

invalid dedicated instance type: %s

What it means

When spec.tenancy is set to something other than 'default', kOps only supports dedicated/hidden tenancy on AWS, and even there certain instance types are not allowed with dedicated tenancy. If the machine type appears in awsDedicatedInstanceExceptions, this error is thrown.

Source

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

		}
	}

	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)
		if err != nil {
			return nil, fmt.Errorf("unable to determine default image for instance group %q: %v", ig.ObjectMeta.Name, err)
		}
	}

	if ig.Spec.Tenancy != "" && ig.Spec.Tenancy != "default" {
		switch cluster.GetCloudProvider() {
		case kops.CloudProviderAWS:
			if _, ok := awsDedicatedInstanceExceptions[ig.Spec.MachineType]; ok {
				return nil, fmt.Errorf("invalid dedicated instance type: %s", ig.Spec.MachineType)
			}
		default:
			klog.Warning("Trying to set tenancy on non-AWS environment")
		}
	}

	if ig.IsControlPlane() {
		if len(ig.Spec.Subnets) == 0 {
			return nil, fmt.Errorf("control-plane InstanceGroup %s did not specify any Subnets", ig.ObjectMeta.Name)
		}
	} else if ig.IsAPIServerOnly() && cluster.Spec.IsIPv6Only() {
		if len(ig.Spec.Subnets) == 0 {
			for _, subnet := range cluster.Spec.Networking.Subnets {
				if subnet.Type != kops.SubnetTypePrivate && subnet.Type != kops.SubnetTypeUtility {
					ig.Spec.Subnets = append(ig.Spec.Subnets, subnet.Name)
				}
			}
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Change spec.machineType to an instance type supporting dedicated tenancy (e.g. m5, c5 families)
  2. Remove spec.tenancy or set it to 'default' if dedicated tenancy isn't required
  3. Review the awsDedicatedInstanceExceptions list in populate_instancegroup_spec.go to pick a valid type

Example fix

// before
spec:
  tenancy: dedicated
  machineType: t3.medium
// after
spec:
  tenancy: dedicated
  machineType: m5.large
Defensive patterns

Strategy: validation

Validate before calling

// Validate tenancy/machineType compatibility before apply
if ig.Spec.Tenancy != "" && ig.Spec.Tenancy != "default" && cluster.GetCloudProvider() == kops.CloudProviderAWS {
    if strings.HasPrefix(ig.Spec.MachineType, "t2.") || strings.HasPrefix(ig.Spec.MachineType, "t3.") {
        return fmt.Errorf("%s does not support dedicated tenancy", ig.Spec.MachineType)
    }
}

Prevention

When it happens

Trigger: An InstanceGroup with cloudProvider AWS, spec.tenancy: dedicated (or reserved/hidden), and spec.machineType listed in awsDedicatedInstanceExceptions (e.g. t2, t3, nano/micro burstable families that don't support dedicated tenancy).

Common situations: Copying a node spec with tenancy: dedicated onto t3/t2 burstable instances; setting tenancy on GCE/OpenStack clusters (triggers only a warning, not this error, but often a config mistake); not realizing dedicated instances incur large AWS surcharges and aren't available for all families.

Related errors


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