kubernetes/kops · error

spotinst: failed to create elastigroup: %v

Error message

spotinst: failed to create elastigroup: %v

What it means

create() wraps any Spotinst Create API error that is not the retryable IAM-instance-profile case (or that failed client.Errors type assertion) with this message. It means Elastigroup creation was rejected or failed at the Spotinst API level.

Source

Thrown at upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go:791

		_, err = cloud.Spotinst().Elastigroup().Create(context.Background(), eg)
		if err == nil {
			break
		}

		if errs, ok := err.(client.Errors); ok {
			for _, err := range errs {
				if strings.Contains(err.Message, "Invalid IAM Instance Profile name") {
					if attempt > maxAttempts {
						return fmt.Errorf("IAM instance profile not yet created/propagated (original error: %v)", err)
					}

					klog.V(4).Infof("Got an error indicating that the IAM instance profile %q is not ready %q", fi.ValueOf(e.IAMInstanceProfile.Name), err)
					klog.Infof("Waiting for IAM instance profile %q to be ready", fi.ValueOf(e.IAMInstanceProfile.Name))
					goto readyLoop
				}
			}

			return fmt.Errorf("spotinst: failed to create elastigroup: %v", err)
		}
	}

	return nil
}

func (_ *Elastigroup) update(cloud awsup.AWSCloud, a, e, changes *Elastigroup) error {
	klog.V(2).Infof("Updating Elastigroup %q", *e.Name)

	actual, err := e.find(cloud.Spotinst().Elastigroup())
	if err != nil {
		klog.Errorf("Unable to resolve Elastigroup %q, error: %v", *e.Name, err)
		return err
	}

	var changed bool
	group := new(aws.Group)
	group.SetId(actual.ID)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped %v detail — it names the exact Spotinst validation failure (e.g. invalid image, subnet, or load balancer).
  2. Verify Spotinst credentials/account are valid and that the target AWS account/region is connected in Spotinst.
  3. Cross-check the spec values the error implicates (image, subnets, instance types, load balancer name) against real AWS resources.
  4. If related to a missing image, fix resolveImage input; if IAM related, see the instance-profile propagation handling and retry.
Defensive patterns

Strategy: validation

Validate before calling

// pre-validate the inputs Spotinst will reject
if err := validateSubnetsExist(cloud, e.Subnets); err != nil {
    return err
}
if e.Image != nil {
    if _, err := resolveImage(cloud, fi.ValueOf(e.Image)); err != nil {
        return err // fail fast with the image error, not a generic create failure
    }
}

Try / catch

err := cloud.Spotinst().Elastigroup().Create(ctx, eg)
if err != nil {
    if errs, ok := err.(client.Errors); ok {
        for _, ce := range errs {
            if strings.Contains(ce.Message, "Invalid IAM Instance Profile name") {
                // handled by the IAM propagation retry path
                continue
            }
        }
    }
    return fmt.Errorf("spotinst: failed to create elastigroup: %v", err)
}

Prevention

When it happens

Trigger: createOrUpdate takes the create path (no existing group found) and cloud.Spotinst().Elastigroup().Create(context.Background(), eg) fails; the error is either not a client.Errors slice or none of the messages contained "Invalid IAM Instance Profile name".

Common situations: Invalid Elastigroup parameters (bad AMI, invalid subnet/instance type, image not found); Spotinst token/account misconfiguration; Spotinst rejecting the strategy or load-balancer config; quota limits on the Spotinst account.

Related errors


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