kubernetes/kops · error

spotinst: failed to find ocean %q: %v

Error message

spotinst: failed to find ocean %q: %v

What it means

Ocean.find lists all Oceans in the Spotinst account to locate the cluster's Ocean. If the Spotinst List API call fails, the error is wrapped with this message. This is an API-level failure before any name matching occurs.

Source

Thrown at upup/pkg/fi/cloudup/spotinsttasks/ocean.go:118

	if o.SecurityGroups != nil {
		for _, sg := range o.SecurityGroups {
			deps = append(deps, sg)
		}
	}

	if o.UserData != nil {
		deps = append(deps, fi.FindDependencies(tasks, o.UserData)...)
	}

	return deps
}

func (o *Ocean) find(svc spotinst.InstanceGroupService) (*aws.Cluster, error) {
	klog.V(4).Infof("Attempting to find Ocean: %q", fi.ValueOf(o.Name))

	oceans, err := svc.List(context.Background())
	if err != nil {
		return nil, fmt.Errorf("spotinst: failed to find ocean %q: %v", fi.ValueOf(o.Name), err)
	}

	var out *aws.Cluster
	for _, ocean := range oceans {
		if ocean.Name() == fi.ValueOf(o.Name) {
			out = ocean.Obj().(*aws.Cluster)
			break
		}
	}
	if out == nil {
		return nil, fmt.Errorf("spotinst: failed to find ocean %q", fi.ValueOf(o.Name))
	}

	klog.V(4).Infof("Ocean/%s: %s", fi.ValueOf(o.Name), stringutil.Stringify(out))
	return out, nil
}

var _ fi.CloudupHasCheckExisting = (*Ocean)(nil)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Validate SPOTINST_TOKEN and SPOTINST_ACCOUNT environment variables
  2. Check connectivity to api.spotinst.com
  3. Retry if the API was rate-limiting or temporarily down
  4. Confirm the Spotinst account is active and not suspended
Defensive patterns

Strategy: retry

Validate before calling

if os.Getenv("SPOTINST_TOKEN") == "" {
    return errors.New("SPOTINST_TOKEN must be set before listing oceans")
}

Try / catch

oceans, err := svc.List(ctx)
if err != nil {
    if attempt < maxRetries {
        time.Sleep(backoff)
        continue
    }
    return fmt.Errorf("spotinst ocean list failed after retries: %w", err)
}

Prevention

When it happens

Trigger: During find (called by Find, create, update, CheckExisting), svc.List(ctx) returns an error from the Spotinst API.

Common situations: Invalid/expired Spotinst token; Spotinst API outage or rate limit; network restrictions from the machine running kops.

Related errors


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