kubernetes/kops · error

found multiple instance groups matching ASG %q

Error message

found multiple instance groups matching ASG %q

What it means

matchInstanceGroup matches an ASG name to a kOps InstanceGroup by comparing names. If more than one InstanceGroup in the cluster has the same name as the ASG's matching group, this error is returned because the mapping would be ambiguous. InstanceGroup names are expected to be unique within a cluster.

Source

Thrown at upup/pkg/fi/cloudup/awsup/instancegroups.go:47

	for _, g := range instancegroups {
		var groupName string
		switch {
		case g.Spec.Role.HasControlPlane():
			groupName = g.ObjectMeta.Name + ".masters." + clusterName
		case g.Spec.Role.HasAPIServer():
			groupName = g.ObjectMeta.Name + ".apiservers." + clusterName
		case g.Spec.Role.HasNode():
			groupName = g.ObjectMeta.Name + "." + clusterName
		case g.Spec.Role.HasBastion():
			groupName = g.ObjectMeta.Name + "." + clusterName
		default:
			klog.Warningf("Ignoring InstanceGroup of unknown role %q", g.Spec.Role)
			continue
		}

		if name == groupName {
			if instancegroup != nil {
				return nil, fmt.Errorf("found multiple instance groups matching ASG %q", groupName)
			}
			instancegroup = g
		}
	}

	return instancegroup, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run `kops get instancegroups --name <cluster>` and find the duplicate InstanceGroup name.
  2. Rename one of the duplicate InstanceGroups to a unique name (e.g. nodes-a, nodes-b) with `kops edit instancegroup`.
  3. Apply the updated spec (`kops update cluster`) so cloud resources and specs agree.
  4. If intentional, ensure the ASG being matched corresponds to the renamed group.

Example fix

// before (cluster.yaml, two groups both named nodes)
metadata:
  name: nodes
// after
metadata:
  name: nodes-a
# and the second group: name: nodes-b
Defensive patterns

Strategy: validation

Validate before calling

names := map[string]int{}
for _, ig := range cluster.Spec.InstanceGroups {
	names[*ig.ObjectMeta.Name]++
}
for n, c := range names {
	if c > 1 { return fmt.Errorf("duplicate instance group name: %s", n) }
}

Try / catch

ig, err := matchInstanceGroup(list, asgName)
if err != nil {
	return fmt.Errorf("cannot map ASG %q to instance group: %w", asgName, err)
}

Prevention

When it happens

Trigger: Two or more InstanceGroups in the cluster spec share the same name while getCloudGroups enumerates cloud groups; the ASG name equals that duplicated InstanceGroup name.

Common situations: Hand-edited cluster specs where a node group was cloned (e.g. 'nodes' and 'nodes' instead of 'nodes-a'/'nodes-b'); tooling that duplicates instance groups without renaming; merges of cluster spec changes introducing duplicates.

Related errors


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