kubernetes/kops · error

Found multiple ELBs with name %q

Error message

Found multiple ELBs with name %q

What it means

Thrown when the name-based ELB search returns more than one match: two or more classic load balancers in the region match the filter for the given load balancer name. Find requires a unique ELB and refuses to pick one arbitrarily.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/classic_load_balancer.go:83

		}

		klog.Warningf("Got ELB with unexpected name: %q", aws.ToString(lb.LoadBalancerName))
		return false
	})
	if err != nil {
		if awsup.AWSErrorCode(err) == "LoadBalancerNotFound" {
			return nil, nil
		}

		return nil, fmt.Errorf("error listing ELBs: %v", err)
	}

	if len(found) == 0 {
		return nil, nil
	}

	if len(found) != 1 {
		return nil, fmt.Errorf("Found multiple ELBs with name %q", loadBalancerName)
	}

	return &found[0], nil
}

func describeLoadBalancers(ctx context.Context, cloud awsup.AWSCloud, request *elb.DescribeLoadBalancersInput, filter func(elbtypes.LoadBalancerDescription) bool) ([]elbtypes.LoadBalancerDescription, error) {
	var found []elbtypes.LoadBalancerDescription
	paginator := elb.NewDescribeLoadBalancersPaginator(cloud.ELB(), request)
	for paginator.HasMorePages() {
		output, err := paginator.NextPage(ctx)
		if err != nil {
			return nil, fmt.Errorf("error listing ELBs: %w", err)
		}

		for _, lb := range output.LoadBalancerDescriptions {
			if filter(lb) {
				found = append(found, lb)
			}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run aws elb describe-load-balancers and identify the duplicates
  2. Delete the stale/unused ELB (aws elb delete-load-balancer)
  3. Ensure cluster names are unique per region to avoid name collisions
  4. Clean up orphaned ELBs before re-running kops apply

Example fix

// before: two ELBs with same name pattern
aws elb delete-load-balancer --load-balancer-name mycluster-api  # stale one
// after: only the correct ELB remains
aws elb describe-load-balancers --query 'LoadBalancerDescriptions[].LoadBalancerName'
Defensive patterns

Strategy: validation

Validate before calling

aws elb describe-load-balancers --query "LoadBalancerDescriptions[?LoadBalancerName=='$LB_NAME'] | length(@)"
# expect 1 before running kops apply

Try / catch

catch (err) {
  if (String(err).startsWith('Found multiple ELBs with name')) {
    // list and delete stale duplicates, then retry
  }
  throw err;
}

Prevention

When it happens

Trigger: Multiple classic ELBs share the same LoadBalancerName pattern being filtered (note ELB names are region-unique, so this usually means the filter matches tagged/name-prefixed duplicates) or stale/duplicate ELBs left from previous applies.

Common situations: Leftover ELBs from deleted clusters with the same cluster name; running two clusters with the same name in one region; manual duplicate creation.

Related errors


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