kubernetes/kops · error
duplicate InstanceGroup Name found: %q
Error message
duplicate InstanceGroup Name found: %q
What it means
CreateClusterConfig builds a set of already-seen instance group names and rejects the cluster config if two InstanceGroups share the same ObjectMeta.Name. Duplicate names would collide when the groups are persisted as cluster resources, so the error is raised before any writes happen.
Source
Thrown at pkg/apis/kops/registry/helpers.go:38
"context"
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
api "k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/client/simple"
"k8s.io/kops/pkg/kubemanifest"
)
func CreateClusterConfig(ctx context.Context, clientset simple.Clientset, cluster *api.Cluster, groups []*api.InstanceGroup, addons kubemanifest.ObjectList) error {
// Check for instancegroup Name duplicates before writing
{
names := map[string]bool{}
for i, ns := range groups {
if ns.ObjectMeta.Name == "" {
return fmt.Errorf("InstanceGroup #%d did not have a Name", i+1)
}
if names[ns.ObjectMeta.Name] {
return fmt.Errorf("duplicate InstanceGroup Name found: %q", ns.ObjectMeta.Name)
}
names[ns.ObjectMeta.Name] = true
}
}
_, err := clientset.CreateCluster(ctx, cluster)
if err != nil {
return err
}
for _, ig := range groups {
_, err = clientset.InstanceGroupsFor(cluster).Create(ctx, ig, metav1.CreateOptions{})
if err != nil {
return fmt.Errorf("error writing updated instancegroup configuration: %v", err)
}
}
{View on GitHub (pinned to 4c8573c808)
Solutions
- Rename the duplicate instance groups to unique names (e.g. nodes-a, nodes-b) before calling CreateClusterConfig.
- Deduplicate the groups slice prior to the call, e.g. skip groups whose name is already in a set.
- If generating per-zone groups, include the zone in the name (fmt.Sprintf("nodes-%s", zone)).
- Run `kops get ig` to list existing group names and pick non-conflicting ones.
Example fix
// before
groups = append(groups, masterGroup("nodes"), nodeGroup("nodes"))
// after
groups = append(groups, masterGroup("master-a"), nodeGroup("nodes")) Defensive patterns
Strategy: validation
Validate before calling
func dedupeIGs(groups []*api.InstanceGroup) ([]*api.InstanceGroup, error) {
seen := map[string]bool{}
for _, ig := range groups {
if seen[ig.ObjectMeta.Name] {
return nil, fmt.Errorf("duplicate instance group %q", ig.ObjectMeta.Name)
}
seen[ig.ObjectMeta.Name] = true
}
return groups, nil
} Try / catch
if err := kopsregistry.CreateClusterConfig(ctx, cs, cluster, groups, addons); err != nil {
if strings.Contains(err.Error(), "duplicate InstanceGroup Name") {
var name string
fmt.Sscanf(err.Error(), "duplicate InstanceGroup Name found: %q", &name)
return fmt.Errorf("rename or drop group %q and retry", name)
}
return err
} Prevention
- Generate group names programmatically with unique suffixes (role + zone).
- Deduplicate merged group lists before calling CreateClusterConfig.
- Enforce uniqueness in CI by listing `kops get ig` and checking for repeats.
- Keep a single source of truth for group definitions instead of appending from multiple scripts.
When it happens
Trigger: Calling CreateClusterConfig (from RunCreateCluster) where two or more entries in groups have identical ObjectMeta.Name values — e.g. appending a nodes group twice, generating groups per zone with the same name, or merging group lists without deduplication.
Common situations: Scripts that create one IG per AZ but reuse a fixed name; programmatic cluster construction that appends default groups plus custom groups with clashing names; concatenating manifests from two clusters that both define a 'nodes' group.
Related errors
- InstanceGroup #%d did not have a Name
- must configure at least one InstanceGroup
- must configure at least one ControlPlane InstanceGroup
- error building node labels: %w
- invalid InstanceGroup name: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/246e85ed7c93925e.
Report an issue: GitHub.