kubernetes/kops · error

EtcdMembers found with same name %q in etcd-cluster %q

Error message

EtcdMembers found with same name %q in etcd-cluster %q

What it means

Within one etcd cluster, member names must be unique; run() builds a map keyed on m.Name and throws this error when a duplicate is found. Duplicate names would produce ambiguous DNS/etcd member identities, so cluster population is rejected.

Source

Thrown at upup/pkg/fi/cloudup/populate_cluster_spec.go:140

					return fmt.Errorf("EtcdClusters #%d did not specify a Name", i)
				}

				for i, m := range etcd.Members {
					if m.Name == "" {
						return fmt.Errorf("EtcdMember #%d of etcd-cluster %s did not specify a Name", i, etcd.Name)
					}

					if fi.ValueOf(m.InstanceGroup) == "" {
						return fmt.Errorf("EtcdMember %s:%s did not specify a InstanceGroup", etcd.Name, m.Name)
					}
				}

				etcdInstanceGroups := make(map[string]kopsapi.EtcdMemberSpec)
				etcdNames := make(map[string]kopsapi.EtcdMemberSpec)

				for _, m := range etcd.Members {
					if _, ok := etcdNames[m.Name]; ok {
						return fmt.Errorf("EtcdMembers found with same name %q in etcd-cluster %q", m.Name, etcd.Name)
					}

					instanceGroupName := fi.ValueOf(m.InstanceGroup)

					if _, ok := etcdInstanceGroups[instanceGroupName]; ok {
						klog.Warningf("EtcdMembers are in the same InstanceGroup %q in etcd-cluster %q (fault-tolerance may be reduced)", instanceGroupName, etcd.Name)
					}

					//if clusterSubnets[zone] == nil {
					//	return fmt.Errorf("EtcdMembers for %q is configured in zone %q, but that is not configured at the k8s-cluster level", etcd.Name, m.Zone)
					//}
					etcdNames[m.Name] = m
					etcdInstanceGroups[instanceGroupName] = m
				}

				if (len(etcdNames) % 2) == 0 {
					// Not technically a requirement, but doesn't really make sense to allow
					return fmt.Errorf("there should be an odd number of control-plane-zones, for etcd's quorum.  Hint: Use --zones and --control-plane-zones to declare worker and control plane node zones separately")

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Make each member name unique within its etcd cluster (e.g. a, b, c keyed by zone).
  2. Run `kops get cluster -oyaml` and check spec.etcdClusters[].members[] for repeated `name:` values.
  3. If member names are generated, key them on the instance group or zone so they can't collide.

Example fix

# before
members:
- name: a
  instanceGroup: control-plane-1a
- name: a
  instanceGroup: control-plane-1b
# after
members:
- name: a
  instanceGroup: control-plane-1a
- name: b
  instanceGroup: control-plane-1b
Defensive patterns

Strategy: validation

Validate before calling

seen := map[string]bool{}
for _, etcd := range cluster.Spec.EtcdClusters {
	for _, m := range etcd.Members {
		if seen[m.Name] {
			return fmt.Errorf("duplicate etcd member name %q in %q", m.Name, etcd.Name)
		}
		seen[m.Name] = true
	}
}

Prevention

When it happens

Trigger: PopulateClusterSpec with an EtcdClusters entry where two members share the same Name value — e.g. copy-pasting a member block without changing the name.

Common situations: Copy-pasting etcd member entries in cluster YAML and forgetting to rename; templating loops that reuse a fixed name; merging specs from different clusters that both use default member names.

Related errors


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