kubernetes/kops · error

spotinst: failed to update elastigroup

Error message

spotinst: failed to update elastigroup: %v

What it means

update() builds the desired Elastigroup object and then calls the Spotinst Update API; any failure is wrapped with this message. The group exists (otherwise find/create path was used), but Spotinst rejected or failed the update request.

Solutions

  1. Read the wrapped error detail for the exact Spotinst validation message and correct the offending field in the cluster spec.
  2. Re-run `kops update cluster` — concurrent-modification style errors often clear on a fresh read/update cycle.
  3. Check whether the group was edited externally (Spotinst console/Spot Ocean UI) and revert conflicting manual changes.
  4. Verify Spotinst API credentials are still valid and the account is connected.
Defensive patterns

Strategy: retry

Validate before calling

// re-read the group immediately before update to minimize concurrent-modification risk
latest, err := e.find(svc)
if err != nil {
    return err
}
applyDesiredState(latest, e) // patch from latest read, not a stale copy

Try / catch

if err := cloud.Spotinst().Elastigroup().Update(context.Background(), eg); err != nil {
    if isTransient(err) { // 429/5xx from Spotinst
        time.Sleep(backoff)
        return e.update(cloud) // fresh read + update
    }
    return fmt.Errorf("spotinst: failed to update elastigroup: %v", err)
}

Prevention

When it happens

Trigger: createOrUpdate takes the update path; find() returned the existing group, kOps mutates it to match the spec, then cloud.Spotinst().Elastigroup().Update(context.Background(), eg) returns an error.

Common situations: Concurrent modification — the group changed in the Spotinst console between find and update; spec changes Spotinst rejects (invalid combination of instance types, removing the only load balancer, resizing constraints); token expiry mid-run; transient Spotinst API 5xx.

Related errors


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

Appendix: source

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

		klog.Warningf("Not all changes applied to Elastigroup %q: %v", *e.Name, changes)
	}

	if !changed {
		klog.V(2).Infof("No changes detected in Elastigroup %q", *e.Name)
		return nil
	}

	klog.V(2).Infof("Updating Elastigroup %q (config: %s)", *e.Name, stringutil.Stringify(group))

	// Wrap the raw object as an Elastigroup.
	eg, err := spotinst.NewElastigroup(cloud.ProviderID(), group)
	if err != nil {
		return err
	}

	// Update the Elastigroup.
	if err := cloud.Spotinst().Elastigroup().Update(context.Background(), eg); err != nil {
		return fmt.Errorf("spotinst: failed to update elastigroup: %v", err)
	}

	return nil
}

type terraformElastigroup struct {
	Name                 *string                                 `cty:"name"`
	Description          *string                                 `cty:"description"`
	Product              *string                                 `cty:"product"`
	Region               *string                                 `cty:"region"`
	SubnetIDs            []*terraformWriter.Literal              `cty:"subnet_ids"`
	LoadBalancers        []*terraformWriter.Literal              `cty:"elastic_load_balancers"`
	TargetGroups         []*terraformWriter.Literal              `cty:"target_group_arns"`
	NetworkInterfaces    []*terraformElastigroupNetworkInterface `cty:"network_interface"`
	RootBlockDevice      *terraformElastigroupBlockDevice        `cty:"ebs_block_device"`
	EphemeralBlockDevice []*terraformElastigroupBlockDevice      `cty:"ephemeral_block_device"`
	Integration          *terraformElastigroupIntegration        `cty:"integration_kubernetes"`
	Tags                 []*terraformKV                          `cty:"tags"`

View on GitHub (pinned to 4c8573c808)