kubernetes/kops · error

Found multiple hosted zones matching cluster %q; please spec

Error message

Found multiple hosted zones matching cluster %q; please specify the ID of the zone to use

What it means

When more than one hosted zone is a suffix match for the cluster DNS name (same maximal length), kops cannot decide which zone to use for records and fails, asking the operator to specify the zone ID explicitly (via the cluster spec's DNSZone / config).

Source

Thrown at upup/pkg/fi/cloudup/utils.go:310

		maxLengthZones = append(maxLengthZones, z)
	}

	if len(maxLengthZones) == 0 {
		// We make this an error because you have to set up DNS delegation anyway
		tokens := strings.Split(clusterDNSName, ".")
		suffix := strings.Join(tokens[len(tokens)-2:], ".")
		// klog.Warningf("No matching hosted zones found; will created %q", suffix)
		// return suffix, nil
		return "", fmt.Errorf("No matching hosted zones found for %q; please create one (e.g. %q) first", clusterDNSName, suffix)
	}

	if len(maxLengthZones) == 1 {
		id := maxLengthZones[0].ID()
		id = strings.TrimPrefix(id, "/hostedzone/")
		return id, nil
	}

	return "", fmt.Errorf("Found multiple hosted zones matching cluster %q; please specify the ID of the zone to use", clusterDNSName)
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set the zone ID explicitly in the cluster spec: `kops edit cluster` then set `spec.dnsZone: Z1DXXXXXXXXXX` (or `--dns-zone` flag at create time).
  2. Delete the duplicate/stale hosted zone in the DNS console (`aws route53 delete-hosted-zone --id ...`).
  3. If public vs private is the cause, keep the intended one for the cluster or pin it via dnsZone.

Example fix

# before
spec: {}
# after
spec:
  dnsZone: Z1DXXXXXXXXXX
Defensive patterns

Strategy: validation

Validate before calling

zones := listMatchingZones(clusterDNSName)
if len(zones) > 1 { return fmt.Errorf("set spec.dnsZone explicitly") }

Prevention

When it happens

Trigger: FindDNSHostedZone encounters two or more hosted zones with identical names covering the cluster domain — e.g. duplicate public and private zones, or a zone accidentally created twice — during create/update cluster.

Common situations: Route53 account contains both a public and private zone for the same domain name; a previous abandoned `create-hosted-zone` left a duplicate; cross-account migration left stale zones; delegation split across example.com and example.com (duplicate) zones.

Related errors


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