kubernetes/kops · error

unexpected instance group role for instance group: %q, %q

Error message

unexpected instance group role for instance group: %q, %q

What it means

buildVMScaleSetTask hit an unhandled instance group role — only control-plane and node are mapped for Azure VM scale sets; both the IG name and its role value are printed.

Source

Thrown at pkg/model/azuremodel/vmscaleset.go:124

	}
	t := &azuretasks.VMScaleSet{
		Name:               new(name),
		Lifecycle:          b.Lifecycle,
		ResourceGroup:      b.LinkToResourceGroup(),
		VirtualNetwork:     b.LinkToVirtualNetwork(),
		SKUName:            new(ig.Spec.MachineType),
		ComputerNamePrefix: new(ig.Name),
		AdminUser:          new(b.Cluster.Spec.CloudProvider.Azure.AdminUser),
		Zones:              azNumbers,
	}

	switch ig.Spec.Role {
	case kops.InstanceGroupRoleControlPlane:
		t.ApplicationSecurityGroups = append(t.ApplicationSecurityGroups, b.LinkToApplicationSecurityGroupControlPlane())
	case kops.InstanceGroupRoleNode:
		t.ApplicationSecurityGroups = append(t.ApplicationSecurityGroups, b.LinkToApplicationSecurityGroupNodes())
	default:
		return nil, fmt.Errorf("unexpected instance group role for instance group: %q, %q", ig.Name, ig.Spec.Role)
	}

	var err error
	if t.Capacity, err = getCapacity(&ig.Spec); err != nil {
		return nil, err
	}

	sp, err := getStorageProfile(&ig.Spec)
	if err != nil {
		return nil, err
	}
	t.StorageProfile = &azuretasks.VMScaleSetStorageProfile{
		VirtualMachineScaleSetStorageProfile: sp,
	}

	if n := len(b.SSHPublicKeys); n > 0 {
		if n > 1 {
			return nil, fmt.Errorf("expected at most one SSH public key; found %d keys", n)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the instance group's role is ControlPlane or Node on Azure
  2. Remove or fix unsupported-role instance groups
  3. Report upstream if the role should be supported
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/model/azuremodel/vmscaleset.go:124 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/2a9d9c596da904b6. Report an issue: GitHub.