kubernetes/kops · error

unknown role %q

Error message

unknown role %q

What it means

RunCreateInstanceGroup parses the --role flag value with ParseInstanceGroupRole; the value supplied is not a recognized InstanceGroupRole (e.g. node, control-plane, bastion), so the IG cannot be built.

Source

Thrown at cmd/kops/create_instancegroup.go:203

	existing, err := clientset.InstanceGroupsFor(cluster).Get(ctx, options.InstanceGroupName, metav1.GetOptions{})
	if err != nil {
		// We expect a NotFound error when creating the instance group
		if !errors.IsNotFound(err) {
			return err
		}
	}

	if existing != nil {
		return fmt.Errorf("instance group %q already exists", options.InstanceGroupName)
	}

	// Populate some defaults
	ig := &kopsapi.InstanceGroup{}
	ig.ObjectMeta.Name = options.InstanceGroupName

	role, ok := kopsapi.ParseInstanceGroupRole(options.Role, true)
	if !ok {
		return fmt.Errorf("unknown role %q", options.Role)
	}
	ig.Spec.Role = role

	ig.Spec.Subnets = options.Subnets

	ig.Spec.Zones = options.Zones

	cloud, err := cloudup.BuildCloud(cluster)
	if err != nil {
		return err
	}

	ig, err = cloudup.PopulateInstanceGroupSpec(cluster, ig, cloud, channel)
	if err != nil {
		return err
	}

	ig.AddInstanceGroupNodeLabel()

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use a valid role: control-plane, node, or bastion (case-insensitive)
  2. Check the flag value for typos
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/create_instancegroup.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/7b6262732211dfdc. Report an issue: GitHub.