kubernetes/kops · error

spotinst does not support surging

Error message

spotinst does not support surging

What it means

DetachInstance is intentionally unimplemented for Spotinst: surging (detaching an instance so it stops counting against the group size while a replacement starts) has no Spotinst equivalent wired up in kOps. Any caller requesting a detach gets this fixed error message. It is a deliberate capability gap, not a runtime fault.

Source

Thrown at pkg/resources/spotinst/resources.go:198

				svc = cloud.Elastigroup()
			case InstanceGroupOcean:
				svc = cloud.Ocean()
			}

			return svc.Detach(context.Background(), obj.Id(), []string{instance.ID})
		}
	case LaunchSpec:
		{
			return cloud.Ocean().Detach(context.Background(), obj.OceanId(), []string{instance.ID})
		}
	}

	return fmt.Errorf("spotinst: unexpected instance group type, got: %T", group.Raw)
}

// DetachInstance is not implemented yet. It needs to cause a cloud instance to no longer be counted against the group's size limits.
func DetachInstance(cloud Cloud, instance *cloudinstances.CloudInstance) error {
	return fmt.Errorf("spotinst does not support surging")
}

// GetCloudGroups returns a list of InstanceGroups as CloudInstanceGroup objects.
func GetCloudGroups(cloud Cloud, cluster *kops.Cluster, instanceGroups []*kops.InstanceGroup,
	warnUnmatched bool, nodes []v1.Node) (map[string]*cloudinstances.CloudInstanceGroup, error,
) {
	cloudInstanceGroups := make(map[string]*cloudinstances.CloudInstanceGroup)
	nodeMap := cloudinstances.GetNodeMap(nodes, cluster)

	// List all resources.
	resources, err := ListResources(cloud, cluster.Name)
	if err != nil {
		return nil, err
	}

	// Build all cloud instance groups.
	for _, resource := range resources {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use rolling update without surging on Spotinst clusters (default behavior replaces instances one at a time)
  2. Detach/remove the instance directly via the Spotinst API or console as a workaround
  3. Implement detach support in the Spotinst provider and contribute upstream
  4. Switch the instance group to a non-Spotinst cloud group if surging is a hard requirement
Defensive patterns

Strategy: fallback

Validate before calling

// Feature-check surging support before requesting detach
func detachSupported(cloud fi.Cloud) bool {
    _, isSpotinst := cloud.(spotinst.Cloud)
    return !isSpotinst // spotinst never supports surging
}

Try / catch

if err := spotinst.DetachInstance(cloud, instance); err != nil {
    if strings.Contains(err.Error(), "does not support surging") {
        klog.V(2).Info("spotinst surging unsupported; falling back to direct replacement")
        return spotinst.DeleteInstance(cloud, instance) // fallback path
    }
    return err
}

Prevention

When it happens

Trigger: Any code path calling DetachInstance (pkg/resources/spotinst/resources.go:198) — typically rolling-update flows that surge capacity by detaching old nodes before terminating — when the cluster's instance groups are backed by Spotinst groups.

Common situations: `kops rolling-update cluster` with surge settings on a Spotinst-backed cluster; automation scripts that call DetachInstance generically across cloud providers; validating Spotinst support for drain-like operations.

Related errors


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