kubernetes/kops · error
spotinst: failed to find elastigroup %s: %v
Error message
spotinst: failed to find elastigroup %s: %v
What it means
The spotinst elastigroup task's find() lists all Elastigroups via the Spotinst API and wraps any List() failure with the group name being searched. This is an API-level failure (auth, network, account), not 'not found'.
Source
Thrown at upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go:178
if e.SecurityGroups != nil {
for _, sg := range e.SecurityGroups {
deps = append(deps, sg)
}
}
if e.UserData != nil {
deps = append(deps, fi.FindDependencies(tasks, e.UserData)...)
}
return deps
}
func (e *Elastigroup) find(svc spotinst.InstanceGroupService) (*aws.Group, error) {
klog.V(4).Infof("Attempting to find Elastigroup: %q", fi.ValueOf(e.Name))
groups, err := svc.List(context.Background())
if err != nil {
return nil, fmt.Errorf("spotinst: failed to find elastigroup %s: %v", fi.ValueOf(e.Name), err)
}
var out *aws.Group
for _, group := range groups {
if group.Name() == fi.ValueOf(e.Name) {
out = group.Obj().(*aws.Group)
break
}
}
if out == nil {
return nil, fmt.Errorf("spotinst: failed to find elastigroup %q", fi.ValueOf(e.Name))
}
klog.V(4).Infof("Elastigroup/%s: %s", fi.ValueOf(e.Name), stringutil.Stringify(out))
return out, nil
}
var _ fi.CloudupHasCheckExisting = (*Elastigroup)(nil)View on GitHub (pinned to 4c8573c808)
Solutions
- Verify the Spotinst credentials (token/account id) used by kOps are valid and not expired/rotated.
- Test API reachability: curl -H "Authorization: Bearer $SPOTINST_TOKEN" https://api.spotinst.io/aws/ec2/group — fix proxy/DNS if it fails.
- Confirm the account configured matches the account that owns the cluster's Elastigroups.
- Retry the update if the wrapped error indicates a transient Spotinst 5xx.
Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: verify Spotinst API access before running update
tok := os.Getenv("SPOTINST_TOKEN")
if tok == "" {
return fmt.Errorf("SPOTINST_TOKEN not set")
}
req, _ := http.NewRequest("GET", "https://api.spotinst.io/aws/ec2/group", nil)
req.Header.Set("Authorization", "Bearer "+tok)
resp, err := http.DefaultClient.Do(req)
if err != nil || resp.StatusCode != 200 {
return fmt.Errorf("Spotinst API unreachable/unauthorized")
} Try / catch
groups, err := svc.List(context.Background())
if err != nil {
// distinguish auth vs transient before deciding to fail
return nil, fmt.Errorf("spotinst: failed to find elastigroup %s: %v", name, err)
} Prevention
- Keep SPOTINST_TOKEN/SPOTINST_ACCOUNT current in CI
- Check proxy/firewall access to api.spotinst.com
- Retry List on 5xx with backoff
When it happens
Trigger: Find/CheckExisting/update call e.find(svc); svc.List(context.Background()) returns an error from the Spotinst API — invalid token, network failure, or Spotinst service error.
Common situations: Spotinst API token expired or rotated; missing/incorrect SPOTINST_TOKEN or SPOTINST_ACCOUNT environment credentials; corporate proxy blocking api.spotinst.com; transient Spotinst outage.
Related errors
- spotinst: failed to create elastigroup: %v
- spotinst: failed to update elastigroup: %v
- getting AWS credentials: %w
- error building ssh key: %v
- error building load balancers: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/d0e60ff7f5b0b14d.
Report an issue: GitHub.