kubernetes/kops · error

spotinst: error building ocean: %v

Error message

spotinst: error building ocean: %v

What it means

buildOcean failed while constructing the SpotInst Ocean cluster for the collected node instance groups; wraps task-building errors for the Ocean resource, with the real cause in the wrapped error.

Source

Thrown at pkg/model/awsmodel/spotinst.go:203

		case kops.InstanceGroupRoleNode:
			if featureflag.SpotinstOcean.Enabled() {
				nodeSpotInstanceGroups = append(nodeSpotInstanceGroups, ig)
			} else {
				err = b.buildElastigroup(c, ig)
			}

		default:
			err = fmt.Errorf("spotinst: unexpected instance group role: %s", ig.Spec.Role)
		}

		if err != nil {
			return fmt.Errorf("spotinst: error building elastigroup: %v", err)
		}
	}

	if len(nodeSpotInstanceGroups) > 0 {
		if err = b.buildOcean(c, nodeSpotInstanceGroups...); err != nil {
			return fmt.Errorf("spotinst: error building ocean: %v", err)
		}
	}

	return nil
}

func (b *SpotInstanceGroupModelBuilder) buildElastigroup(c *fi.CloudupModelBuilderContext, ig *kops.InstanceGroup) (err error) {
	klog.V(4).Infof("Building instance group as Elastigroup: %q", b.AutoscalingGroupName(ig))
	group := &spotinsttasks.Elastigroup{
		Lifecycle:            b.Lifecycle,
		Name:                 new(b.AutoscalingGroupName(ig)),
		Region:               new(b.Region),
		ImageID:              new(ig.Spec.Image),
		OnDemandInstanceType: new(strings.Split(ig.Spec.MachineType, ",")[0]),
		SpotInstanceTypes:    strings.Split(ig.Spec.MachineType, ","),
	}

	// Cloud config.

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped error for the failing field
  2. Verify the node instance group specs are compatible with Ocean
  3. Retry after fixing the cluster spec
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/model/awsmodel/spotinst.go:203 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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