kubernetes/kops · error

spotinst: unexpected instance group role: %s

Error message

spotinst: unexpected instance group role: %s

What it means

The SpotInst model builder encountered an instance group role it cannot map — only control-plane, bastion, and node are handled; e.g. an api-server-role instance group in a SpotInst-enabled cluster.

Source

Thrown at pkg/model/awsmodel/spotinst.go:193

		klog.V(2).Infof("Building instance group: %q", name)
		switch ig.Spec.Role {

		// Create both Master and Bastion instance groups as Elastigroups.
		case kops.InstanceGroupRoleControlPlane, kops.InstanceGroupRoleBastion:
			err = b.buildElastigroup(c, ig)

		// Create Node instance groups as Elastigroups or a single Ocean with
		// multiple LaunchSpecs.
		case kops.InstanceGroupRoleNode:
			if featureflag.SpotinstOcean.Enabled() {
				nodeSpotInstanceGroups = append(nodeSpotInstanceGroups, ig)
			} else {
				err = b.buildElastigroup(c, ig)
			}

		default:
			err = fmt.Errorf("spotinst: unexpected instance group role: %s", ig.Spec.Role)
		}

		if err != nil {
			return fmt.Errorf("spotinst: error building elastigroup: %v", err)
		}
	}

	if len(nodeSpotInstanceGroups) > 0 {
		if err = b.buildOcean(c, nodeSpotInstanceGroups...); err != nil {
			return fmt.Errorf("spotinst: error building ocean: %v", err)
		}
	}

	return nil
}

func (b *SpotInstanceGroupModelBuilder) buildElastigroup(c *fi.CloudupModelBuilderContext, ig *kops.InstanceGroup) (err error) {
	klog.V(4).Infof("Building instance group as Elastigroup: %q", b.AutoscalingGroupName(ig))

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Move the workload to a supported role or disable SpotInst for that instance group
  2. Check the instance group's spec.role
  3. Report upstream if the role should be supported
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/model/awsmodel/spotinst.go:193 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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