kubernetes/kops · error
spotinst: failed to create launch spec: %v
Error message
spotinst: failed to create launch spec: %v
What it means
create calls the Spotinst LaunchSpec Create API and wraps any API error with this message. The launch spec (one instance group's configuration under an Ocean) could not be created on the Spotinst side.
Source
Thrown at upup/pkg/fi/cloudup/spotinsttasks/launch_spec.go:589
{
if e.InstanceMetadataOptions != nil {
opt := new(aws.LaunchspecInstanceMetadataOptions)
opt.SetHTTPPutResponseHopLimit(new(int(fi.ValueOf(e.InstanceMetadataOptions.HTTPPutResponseHopLimit))))
opt.SetHTTPTokens(new(fi.ValueOf(e.InstanceMetadataOptions.HTTPTokens)))
spec.SetLaunchspecInstanceMetadataOptions(opt)
}
}
// Wrap the raw object as a LaunchSpec.
sp, err := spotinst.NewLaunchSpec(cloud.ProviderID(), spec)
if err != nil {
return err
}
// Create a new LaunchSpec.
_, err = cloud.Spotinst().LaunchSpec().Create(context.Background(), sp)
if err != nil {
return fmt.Errorf("spotinst: failed to create launch spec: %v", err)
}
return nil
}
func (_ *LaunchSpec) update(cloud awsup.AWSCloud, a, e, changes *LaunchSpec) error {
klog.V(2).Infof("Updating Launch Spec for Ocean %q", *a.Ocean.Name)
ocean, err := a.Ocean.find(cloud.Spotinst().Ocean())
if err != nil {
klog.Errorf("Unable to resolve Ocean %q, error: %v", *a.Ocean.Name, err)
return err
}
actual, err := e.find(cloud.Spotinst().LaunchSpec(), *ocean.ID)
if err != nil {
klog.Errorf("Unable to resolve Launch Spec %q, error: %v", *e.Name, err)
return errView on GitHub (pinned to 4c8573c808)
Solutions
- Read the wrapped %v detail for the underlying Spotinst API reason
- Validate the instance group spec (subnets, instance types, IAM profile) in the cluster spec
- Check Spotinst account quota/permissions in the console
- Verify SPOTINST_TOKEN and SPOTINST_ACCOUNT are correct
Defensive patterns
Strategy: try-catch
Validate before calling
if sp == nil || fi.ValueOf(sp.Name) == "" {
return errors.New("launch spec must have a name before create")
}
if len(subnetIDs) == 0 {
return errors.New("launch spec requires at least one subnet")
} Try / catch
if _, err := svc.Create(ctx, sp); err != nil {
var cerrs client.Errors
if errors.As(err, &cerrs) {
for _, ce := range cerrs {
if strings.Contains(ce.Message, "already exists") {
// fall back to find-and-update path
}
}
}
return fmt.Errorf("spotinst: failed to create launch spec: %w", err)
} Prevention
- Validate instance types and subnets against the Ocean region before apply
- Check Spotinst account quotas when adding many groups
- Ensure the launch spec name is unique within the Ocean
- Keep Spotinst tokens scoped with write permissions
When it happens
Trigger: During createOrUpdate, cloud.Spotinst().LaunchSpec().Create(ctx, sp) returns a non-nil error (validation failure, quota, auth, duplicate name).
Common situations: Invalid instance type or subnet referenced in the spec; Spotinst account limits exceeded; duplicate launch spec name; Spotinst token lacks permissions.
Related errors
- spotinst: failed to find launch spec %q: %v
- spotinst: failed to update launch spec: %v
- error building launch spec: %v
- spotinst: error listing resources: %v
- error creating SQS queue: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/aa4ac5c15a3bd58e.
Report an issue: GitHub.