kubernetes/kops · error

instance group %q already exists

Error message

instance group %q already exists

What it means

RunCreateInstanceGroup fetched the named instance group and got an existing object back (the Get did not return NotFound). Creating an IG with a duplicate name is rejected to avoid overwriting existing configuration.

Source

Thrown at cmd/kops/create_instancegroup.go:194

	if err != nil {
		return err
	}

	channel, err := cloudup.ChannelForCluster(clientset.VFSContext(), cluster)
	if err != nil {
		klog.Warningf("%v", err)
	}

	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 {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Choose a different instance group name
  2. Edit the existing instance group instead: kops edit ig <name>
  3. Delete the existing IG first if replacement is intended
Defensive patterns

Strategy: validation

When it happens

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