kubernetes/kops · error
spotinst: error building cloud instance group: %v
Error message
spotinst: error building cloud instance group: %v
What it means
GetCloudGroups converts Spotinst resources into CloudInstanceGroup objects via buildCloudInstanceGroupFromResource. If that builder returns an error (e.g. the referenced kOps instance group no longer exists or the resource payload is malformed), the error is wrapped with this message and group discovery fails. Without cloud groups, delete/rolling-update flows cannot proceed.
Source
Thrown at pkg/resources/spotinst/resources.go:228
if err != nil {
return nil, err
}
// Build all cloud instance groups.
for _, resource := range resources {
// Filter out the Ocean resources (they're not needed for now since
// we fetch the instances from the launch specs).
if ResourceType(resource.Type) == ResourceTypeInstanceGroup {
if resource.Obj.(InstanceGroup).Type() == InstanceGroupOcean {
continue
}
}
// Build cloud instance group.
ig, err := buildCloudInstanceGroupFromResource(cloud, cluster, instanceGroups, resource, nodeMap)
if err != nil {
return nil, fmt.Errorf("spotinst: error building cloud instance group: %v", err)
}
if ig == nil {
if warnUnmatched {
klog.V(2).Infof("Found group with no corresponding instance group: %q", resource.Name)
}
continue
}
cloudInstanceGroups[resource.Name] = ig
}
return cloudInstanceGroups, nil
}
func buildCloudInstanceGroupFromResource(cloud Cloud, cluster *kops.Cluster,
instanceGroups []*kops.InstanceGroup, resource *resources.Resource,
nodeMap map[string]*v1.Node) (*cloudinstances.CloudInstanceGroup, error,
) {View on GitHub (pinned to 4c8573c808)
Solutions
- Reconcile the kops instance group spec with the Spotinst groups (`kops get ig`) — recreate or rename to match
- Delete the orphaned Spotinst group via the Spotinst console/API
- Check the inner %v error to identify the exact field/mapping that failed
- Re-run `kops update cluster --yes` to re-sync Spotinst groups with the cluster spec
Example fix
// before: instance group 'workers' deleted from cluster.yaml but still in Spotinst // after kops create ig workers -f - <<EOF ... EOF kops update cluster --name mycluster --yes
Defensive patterns
Strategy: validation
Validate before calling
// Confirm every Spotinst group maps to a kops instance group before delete
for _, ig := range cluster.Spec.InstanceGroups {
klog.V(2).Infof("kops ig: %s", ig.Name) // compare with spotinst group names/tags
}
// Orphans (spotinst groups with no matching ig) should be reconciled first via kops update cluster Try / catch
groups, err := spotinst.GetCloudGroups(cloud, cluster, instanceGroups, warnUnmatched, nodes)
if err != nil {
if strings.Contains(err.Error(), "error building cloud instance group") {
klog.Errorf("orphaned/mismatched spotinst group; run 'kops update cluster --yes' or remove the group in spotinst console")
return err
}
return err
} Prevention
- Keep kops instance group spec in sync with Spotinst groups
- Delete Spotinst groups before removing them from the cluster spec
- Never rename instance groups without running kops update cluster
- Ensure Spotinst resources carry the proper cluster tags
When it happens
Trigger: GetCloudGroups (pkg/resources/spotinst/resources.go:228) iterates Spotinst resources and one fails to map: the Spotinst group's name/tag references a kops InstanceGroup deleted from the cluster spec, or buildCloudInstanceGroupFromResource hits a nil/malformed field in the group payload.
Common situations: Instance group removed from kOps cluster spec but still exists in Spotinst; name mismatch after renaming an instance group; Spotinst group created manually without proper cluster tags; version drift changing resource field layout.
Related errors
- DeleteGroup not implemented on azureCloud
- error building launch spec: %v
- spotinst: unexpected instance group type, got: %T
- error deleting group %q: %w
- ErrAlreadyExists
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/ba4590adfb9d4b2c.
Report an issue: GitHub.