kubernetes/kops · error
found multiple DNS Zones matching %q
Error message
found multiple DNS Zones matching %q
What it means
If more than one zone in the provider matches cluster.Spec.DNSZone (by ID or name), findZone refuses to guess and returns 'found multiple DNS Zones matching %q', logging the candidate zone IDs. kOps requires an unambiguous zone reference to place cluster DNS records.
Source
Thrown at upup/pkg/fi/cloudup/dns.go:84
findName := strings.TrimSuffix(cluster.Spec.DNSZone, ".")
for _, zone := range zones {
id := zone.ID()
name := strings.TrimSuffix(zone.Name(), ".")
if id == cluster.Spec.DNSZone || name == findName {
matches = append(matches, zone)
}
}
if len(matches) == 0 {
return nil, fmt.Errorf("cannot find DNS Zone %q. Please pre-create the zone and set up NS records so that it resolves", cluster.Spec.DNSZone)
}
if len(matches) > 1 {
klog.Infof("Found multiple DNS Zones matching %q, please set the cluster's spec.dnsZone to the desired Zone ID:", cluster.Spec.DNSZone)
for _, zone := range zones {
id := zone.ID()
klog.Infof("\t%s", id)
}
return nil, fmt.Errorf("found multiple DNS Zones matching %q", cluster.Spec.DNSZone)
}
zone := matches[0]
return zone, nil
}
func validateDNS(cluster *kops.Cluster, cloud fi.Cloud) error {
if !cluster.PublishesDNSRecords() || cluster.UsesPrivateDNS() {
klog.V(2).Infof("Skipping DNS validation for non-public DNS")
return nil
}
zone, err := findZone(cluster, cloud)
if err != nil {
return err
}
if zone == nil {
return nilView on GitHub (pinned to 4c8573c808)
Solutions
- Set spec.dnsZone to the specific zone ID (e.g. /hostedzone/Z123456ABCDEFG) instead of the zone name to disambiguate
- Delete or consolidate the duplicate/stale DNS zone in the provider console
- Re-run after ensuring only one matching zone exists
Example fix
// before spec: dnsZone: "example.com" # matches public and private zones // after spec: dnsZone: "/hostedzone/Z1D633PJN98FT9" # exact zone ID
Defensive patterns
Strategy: validation
Validate before calling
// Use the unambiguous zone ID form
if !strings.HasPrefix(cluster.Spec.DNSZone, "/hostedzone/") && zoneNameIsAmbiguous(cluster.Spec.DNSZone) {
return errors.New("multiple zones match name; set dnsZone to the zone ID")
} Try / catch
zone, err := findZone(cluster, cloud)
if err != nil {
if strings.Contains(err.Error(), "found multiple DNS Zones") {
return fmt.Errorf("set spec.dnsZone to one of the logged zone IDs")
}
return err
} Prevention
- Reference zones by ID when public and private zones share a name
- Remove stale/duplicate hosted zones
- Standardize one hosted zone per domain per account
When it happens
Trigger: validateDNS/precreateDNS where DNSZone string matches both a zone ID and another zone's name, or matches multiple zones — e.g. one zone name given but both a public and private hosted zone with the same domain exist.
Common situations: Duplicate hosted zones with the same domain (public + private) in Route53; a stale and a recreated zone both present; specifying a name that also equals another zone's ID string.
Related errors
- found multiple hosted zones matched name %q
- Found multiple hosted zones matching cluster %q; please spec
- error applying DNS changeset for zone %s: %v
- DNS ZoneID not set
- error deleting route53 record %q: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/d98e48665b1eaca2.
Report an issue: GitHub.