kubernetes/kops · error

building instance group model: %w

Error message

building instance group model: %w

What it means

BuildConfig calls kopsmodel.ForInstanceGroup to build the instance-group model used for nodeup config. If that model construction fails, the error is wrapped as 'building instance group model'. The cause typically comes from validation or unsupported fields in the IG spec.

Source

Thrown at pkg/nodemodel/nodeupconfigbuilder.go:195

	cluster := n.cluster

	if ig == nil {
		return nil, nil, fmt.Errorf("instanceGroup cannot be nil")
	}

	role := ig.Spec.Role
	if role == "" {
		return nil, nil, fmt.Errorf("cannot determine role for instance group: %v", ig.ObjectMeta.Name)
	}

	isMaster := role.HasControlPlane()
	hasAPIServer := isMaster || role.HasAPIServer()

	config, bootConfig := nodeup.NewConfig(cluster, ig)

	igModel, err := kopsmodel.ForInstanceGroup(cluster, ig)
	if err != nil {
		return nil, nil, fmt.Errorf("building instance group model: %w", err)
	}

	if !hasAPIServer && n.assetBuilder.KubeletSupportedVersion != "" {
		// Set kubernetes version to avoid spurious rolling-update
		config.KubernetesVersion = n.assetBuilder.KubeletSupportedVersion

		// TODO: Rename KubernetesVersion to ControlPlaneVersion

		if err := igModel.ForceKubernetesVersion(n.assetBuilder.KubeletSupportedVersion); err != nil {
			return nil, nil, err
		}
	}

	kubernetesAssets, err := BuildKubernetesFileAssets(igModel, n.assetBuilder)
	if err != nil {
		return nil, nil, err
	}
	config.Assets = make(map[architectures.Architecture][]string)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped cause (%w) for the specific model failure and fix the offending IG field
  2. Validate the instance group with kops tooling (kops replace/validate -f) before bootstrapping
  3. Align kOps versions between cluster management and nodeup binary
Defensive patterns

Strategy: try-catch

Try / catch

igModel, err := kopsmodel.ForInstanceGroup(cluster, ig)
if err != nil {
    return fmt.Errorf("building instance group model: %w", err) // inspect cause, fix IG field
}

Prevention

When it happens

Trigger: kopsmodel.ForInstanceGroup(cluster, ig) returns an error while building nodeup config — e.g. invalid or unsupported instance group spec fields.

Common situations: Incompatible combination of cluster spec and IG spec (new feature flags with old kOps); invalid machine type/architecture fields; corrupted or hand-edited IG spec.

Related errors


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