kubernetes/kops · error
error building launch spec: %v
Error message
error building launch spec: %v
What it means
Wrapped error raised in buildOcean (pkg/model/awsmodel/spotinst.go:549) when b.buildLaunchSpec(c, g, ig, ocean) fails while creating a Spotinst Launch Spec for one of the instance groups attached to the Ocean cluster. The launch spec builder does label parsing (instance types, spot percentage, etc.), user data, IAM, volumes, security groups and subnets; any of those failures is wrapped here.
Source
Thrown at pkg/model/awsmodel/spotinst.go:549
}
// Public IP.
ocean.AssociatePublicIPAddress, err = b.buildPublicIPOpts(ig)
if err != nil {
return fmt.Errorf("error building public ip options: %v", err)
}
// Tags.
ocean.Tags, err = b.buildTags(ig)
if err != nil {
return fmt.Errorf("error building cloud tags: %v", err)
}
}
// Create a Launch Spec for each instance group.
for _, g := range igs {
if err := b.buildLaunchSpec(c, g, ig, ocean); err != nil {
return fmt.Errorf("error building launch spec: %v", err)
}
}
klog.V(4).Infof("Adding task: Ocean/%s", fi.ValueOf(ocean.Name))
c.AddTask(ocean)
klog.V(4).Infof("Finish task: Ocean/%s", fi.ValueOf(ocean.Name))
return nil
}
func (b *SpotInstanceGroupModelBuilder) buildLaunchSpec(c *fi.CloudupModelBuilderContext,
ig, igOcean *kops.InstanceGroup, ocean *spotinsttasks.Ocean) (err error) {
klog.V(4).Infof("Building instance group as LaunchSpec: %q", b.AutoscalingGroupName(ig))
launchSpec := &spotinsttasks.LaunchSpec{
Name: new(b.AutoscalingGroupName(ig)),
Lifecycle: b.Lifecycle,
ImageID: new(ig.Spec.Image),
Ocean: ocean, // link to Ocean
}View on GitHub (pinned to 4c8573c808)
Solutions
- Read the inner error to identify which nested step failed and on which IG
- Validate all spotinst.* labels on the failing IG (instance types list, integers, booleans)
- Ensure the failing IG's subnets, IAM role and volume settings are valid per the cluster spec
- Re-run kops update cluster after fixing the offending instance group
Example fix
# before labels: spotinst.io/spot-percentage: "fifty" # after labels: spotinst.io/spot-percentage: "50"
Defensive patterns
Strategy: try-catch
Validate before calling
for k, v := range ig.ObjectMeta.Labels {
switch k {
case "spotinst.io/spot-percentage":
if _, err := strconv.Atoi(v); err != nil { return err }
case "spotinst.io/restrict-scale-down":
if _, err := strconv.ParseBool(v); err != nil { return err }
case "spotinst.io/instance-types":
_ = strings.Split(v, ",")
}
} Try / catch
for _, g := range igs {
if err := buildLaunchSpec(c, g, igOcean, ocean); err != nil {
if strings.Contains(err.Error(), "launch spec") {
klog.Errorf("launch spec failed for IG %s: %v", g.Name, err)
continue // or abort after logging which IG failed
}
return err
}
} Prevention
- Validate all spotinst.* label values (ints, bools, comma lists) per IG
- Ensure every attached IG has valid subnets/IAM/volume config
- Name IGs clearly so launch-spec errors map to the right group
- Test Spotinst configs in a staging cluster first
When it happens
Trigger: Rendering Ocean launch specs for each non-template IG when a spotinst label value is malformed (bad parseInt/parseBool/parseStringSlice) or any nested build step (user data, IAM, subnets, tags) errors for that IG.
Common situations: spotinst.io/instance-types or spot-percentage labels with bad values; an attached node IG with broken subnets/IAM config; the same underlying issues as the per-step errors but attributed to a specific launch-spec IG.
Related errors
- ErrAlreadyExists
- error parsing Kubernetes version %q: %v
- cannot find subnet %q (declared in instance group %q, not fo
- InstanceGroup #%d did not have a Name
- duplicate InstanceGroup Name found: %q
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/417800850c6abfc9.
Report an issue: GitHub.