kubernetes/kops · error

error looking up machine type info: %v

Error message

error looking up machine type info: %v

What it means

When GPU support is enabled (cluster-level or InstanceGroup containerd nvidiaGPU) on AWS, kOps queries EC2 for the instance type info via awsup.GetMachineTypeInfo to check whether the type actually has a GPU. Failure to look up that info produces this error.

Source

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

				}
			}
		}
	}

	if len(ig.Spec.Subnets) == 0 {
		return nil, fmt.Errorf("unable to infer any Subnets for InstanceGroup %s ", ig.ObjectMeta.Name)
	}

	hasGPU := false
	clusterNvidia := cluster.Spec.Containerd != nil && cluster.Spec.Containerd.NvidiaGPU != nil && fi.ValueOf(cluster.Spec.Containerd.NvidiaGPU.Enabled)
	igNvidia := ig.Spec.Containerd != nil && ig.Spec.Containerd.NvidiaGPU != nil && fi.ValueOf(ig.Spec.Containerd.NvidiaGPU.Enabled)

	switch cluster.GetCloudProvider() {
	case kops.CloudProviderAWS:
		if clusterNvidia || igNvidia {
			mt, err := awsup.GetMachineTypeInfo(cloud.(awsup.AWSCloud), ec2types.InstanceType(ig.Spec.MachineType))
			if err != nil {
				return ig, fmt.Errorf("error looking up machine type info: %v", err)
			}
			hasGPU = mt.GPU
		}
	case kops.CloudProviderOpenstack:
		if igNvidia {
			hasGPU = true
		}
	}

	if hasGPU {
		if ig.Spec.NodeLabels == nil {
			ig.Spec.NodeLabels = make(map[string]string)
		}
		ig.Spec.NodeLabels["kops.k8s.io/gpu"] = "1"
		hasNvidiaTaint := false
		for _, taint := range ig.Spec.Taints {
			if strings.HasPrefix(taint, "nvidia.com/gpu") {
				hasNvidiaTaint = true

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify spec.machineType is a valid AWS GPU instance type
  2. Check AWS credentials/IAM permissions for ec2:DescribeInstanceTypes and connectivity
  3. Upgrade kOps if the instance family is newer than the release
  4. If GPU isn't actually needed, remove the nvidiaGPU block to skip the lookup

Example fix

// before
spec:
  machineType: p3.2xlarage
  containerd:
    nvidiaGPU:
      enabled: true
// after
spec:
  machineType: p3.2xlarge
  containerd:
    nvidiaGPU:
      enabled: true
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-verify GPU instance type is resolvable before enabling nvidiaGPU
// aws ec2 describe-instance-types --instance-types p3.2xlarge --region <region>
if gpuEnabled && !strings.HasSuffix(ig.Spec.MachineType, "large") == false && !isKnownGPUFamily(ig.Spec.MachineType) {
    return fmt.Errorf("machineType %s is not a known GPU type; fix before enabling nvidiaGPU", ig.Spec.MachineType)
}

Type guard

func isKnownGPUFamily(mt string) bool {
	for _, p := range []string{"p3.", "p4d.", "p5.", "g4dn.", "g5.", "g6."} {
		if strings.HasPrefix(mt, p) { return true }
	}
	return false
}

Try / catch

if _, err := populateInstanceGroupSpec(...); err != nil {
    if strings.Contains(err.Error(), "error looking up machine type info") {
        // check IAM ec2:DescribeInstanceTypes, region support, then retry with corrected machineType
        return fmt.Errorf("GPU type lookup failed; verify instance type and AWS permissions: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: AWS cluster with containerd.nvidiaGPU.enabled: true and a machineType that GetMachineTypeInfo cannot resolve — invalid instance type name, EC2 API error (credentials, region, throttling), or instance family not known to this kOps version.

Common situations: Typo'd GPU instance type (e.g. p3.2xlarage); IAM policy missing ec2:DescribeInstanceTypes; new GPU families (g6e, p5) with an older kOps; network/API outage during `kops update cluster`.

Related errors


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