kubernetes/kops · error

unknown InstanceGroup Role %s

Error message

unknown InstanceGroup Role %s

What it means

DefaultInstanceGroupVolumeSize in pkg/model/defaults/volumes.go:46 returns the default root volume size per InstanceGroup role (Master/Node/Bastion). If the role is none of the known kops InstanceGroupRole values, it returns -1 with 'unknown InstanceGroup Role'. This guards against a corrupt or future-role spec that the current kOps version does not recognize.

Source

Thrown at pkg/model/defaults/volumes.go:46

	// DefaultVolumeSizeMaster is the default root disk size of a master
	DefaultVolumeSizeMaster = 64
	// DefaultVolumeSizeNode is the default root disk size of a node
	DefaultVolumeSizeNode = 128
)

// DefaultInstanceGroupVolumeSize returns the default volume size for nodes in an InstanceGroup with the specified role
func DefaultInstanceGroupVolumeSize(role kops.InstanceGroupRole) (int32, error) {
	switch role {
	case kops.InstanceGroupRoleControlPlane:
		return DefaultVolumeSizeMaster, nil
	case kops.InstanceGroupRoleAPIServer:
		return DefaultVolumeSizeNode, nil
	case kops.InstanceGroupRoleNode:
		return DefaultVolumeSizeNode, nil
	case kops.InstanceGroupRoleBastion:
		return DefaultVolumeSizeBastion, nil
	default:
		return -1, fmt.Errorf("unknown InstanceGroup Role %s", role)
	}
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run 'kops get ig <name> -o yaml' and confirm spec.role is one of Master|ControlPlane, Node, Bastion (or APIServer on supported versions)
  2. Fix the role value's spelling/casing in the manifest
  3. Use a kOps version that supports the role present in the spec (upgrade if the spec was produced by a newer kOps)
  4. Rebuild the IG with 'kops create ig' instead of hand-editing the role field

Example fix

// before (instance group yaml)
role: master
// after
role: ControlPlane
Defensive patterns

Strategy: type-guard

Validate before calling

switch role {
case kops.InstanceGroupRoleControlPlane, kops.InstanceGroupRoleMaster,
	 kops.InstanceGroupRoleNode, kops.InstanceGroupRoleBastion, kops.InstanceGroupRoleAPIServer:
	// ok
default:
	return fmt.Errorf("IG %q has unsupported role %q for this kOps version", ig.Name, role)
}

Type guard

func knownRole(role kops.InstanceGroupRole) bool {
	switch role {
	case kops.InstanceGroupRoleControlPlane, kops.InstanceGroupRoleMaster,
		 kops.InstanceGroupRoleNode, kops.InstanceGroupRoleBastion,
		 kops.InstanceGroupRoleAPIServer:
		return true
	}
	return false
}

Prevention

When it happens

Trigger: Calling DefaultInstanceGroupVolumeSize with an InstanceGroupRole not in {Master, Node, Bastion} — e.g. an IG spec with a role string like 'APIServer' or 'Worker' from a newer/older kOps version, or a hand-edited manifest with a typo like 'master' lowercase.

Common situations: Downgrading kOps so specs using newer roles (APIServer-only) are no longer understood; hand-edited cluster manifests with mistyped roles; generated specs from tooling that emits unknown role names.

Related errors


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