kubernetes/kops · error

failed to build ephemeral devices: %w

Error message

failed to build ephemeral devices: %w

What it means

RenderAWS builds ephemeral (instance-store) block device mappings for the instance type via buildEphemeralDevices(c.Cloud, instanceType). If that helper fails - typically because the instance type has no known ephemeral device layout - the error is wrapped as 'failed to build ephemeral devices'.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/launchtemplate_target_api.go:72

		},
		NetworkInterfaces: []ec2types.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{
			{
				AssociatePublicIpAddress: t.AssociatePublicIP,
				DeleteOnTermination:      aws.Bool(true),
				DeviceIndex:              new(int32(0)),
				Ipv6AddressCount:         t.IPv6AddressCount,
			},
		},
	}

	// @step: add the actual block device mappings
	rootDevices, err := t.buildRootDevice(c.Cloud)
	if err != nil {
		return fmt.Errorf("failed to build root device: %w", err)
	}
	ephemeralDevices, err := buildEphemeralDevices(c.Cloud, fi.ValueOf(t.InstanceType))
	if err != nil {
		return fmt.Errorf("failed to build ephemeral devices: %w", err)
	}
	additionalDevices, err := buildAdditionalDevices(t.BlockDeviceMappings)
	if err != nil {
		return err
	}
	for _, x := range []map[string]*BlockDeviceMapping{rootDevices, ephemeralDevices, additionalDevices} {
		for name, device := range x {
			data.BlockDeviceMappings = append(data.BlockDeviceMappings, device.ToLaunchTemplateBootDeviceRequest(name))
		}
	}

	// @step: add the ssh key
	if t.SSHKey != nil {
		data.KeyName = t.SSHKey.Name
	}
	// @step: add the security groups
	for _, sg := range t.SecurityGroups {
		data.NetworkInterfaces[0].Groups = append(data.NetworkInterfaces[0].Groups, fi.ValueOf(sg.ID))

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Correct the instanceType in the InstanceGroup to a supported type.
  2. Upgrade kops so its instance-type table knows newer instance types.
  3. If the type is EBS-only and has no ephemeral stores, this usually returns an empty map rather than erroring - re-check the configured type for typos.

Example fix

// before
machineType: m8g.xlarg  // typo / unknown
// after
machineType: m8g.xlarge
Defensive patterns

Strategy: validation

Validate before calling

// verify the instance type is a known, supported type before apply
aws ec2 describe-instance-types --instance-types $MACHINE_TYPE

Try / catch

if strings.Contains(err.Error(), "failed to build ephemeral devices") { correct machineType or upgrade kops for the new type, then re-apply }

Prevention

When it happens

Trigger: RenderAWS on a launchtemplate task where buildEphemeralDevices errors for the given t.InstanceType - e.g. an unknown/unsupported instance type name passed to the device-count lookup.

Common situations: Typo'd or newly released instance type not yet in kOps' instance-type table; requesting ephemeral devices on an EBS-only instance type family; upstream machine type metadata missing the type.

Related errors


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