kubernetes/kops · error

failed to find cluster dns zone

Error message

failed to find cluster dns zone

What it means

After listing zones, ListDNSRecordsets searches for the zone whose name is a suffix of the cluster name. If no zone matches (clusterZone.ID remains empty), this sentinel error is returned. It means the cluster's DNS zone could not be identified among the account's Designate zones.

Source

Thrown at pkg/resources/openstack/dns.go:52

	if os.osCloud.DNSClient() == nil {
		return nil, nil
	}

	zs, err := os.osCloud.ListDNSZones(zones.ListOpts{})
	if err != nil {
		return nil, fmt.Errorf("failed to list dns zones: %s", err)
	}

	var clusterZone zones.Zone
	for _, zone := range zs {
		if strings.HasSuffix(os.clusterName, strings.TrimSuffix(zone.Name, ".")) {
			clusterZone = zone
			break
		}
	}

	if clusterZone.ID == "" {
		return nil, fmt.Errorf("failed to find cluster dns zone")
	}

	rrs, err := os.osCloud.ListDNSRecordsets(clusterZone.ID, nil)
	if err != nil {
		return nil, fmt.Errorf("failed to extract recordsets pages for zone %s: %v", clusterZone.Name, err)
	}

	var resourceTrackers []*resources.Resource
	for _, rr := range rrs {
		if rr.Type != "A" || !strings.HasSuffix(strings.TrimSuffix(rr.Name, "."), os.clusterName) {
			continue
		}

		resourceTracker := &resources.Resource{
			Name: rr.Name,
			ID:   rr.ID,
			Type: typeDNSRecord,
			Deleter: func(cloud fi.Cloud, r *resources.Resource) error {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Create/recreate the DNS zone matching the cluster's domain in Designate
  2. Confirm 'openstack zone list' shows a zone whose name is a suffix of the cluster name
  3. Use the same OpenStack project/credentials the cluster was created with
  4. Check for trailing-dot mismatches between zone name and clusterName
  5. Re-run kops delete once the zone exists

Example fix

// before
if clusterZone.ID == "" {
	return nil, fmt.Errorf("failed to find cluster dns zone")
}
// after
if clusterZone.ID == "" {
	return nil, fmt.Errorf("failed to find cluster dns zone for cluster %q; verify a Designate zone exists for the cluster's domain", os.clusterName)
}
Defensive patterns

Strategy: validation

Validate before calling

# Ensure a zone exists whose name is a suffix of the cluster name
openstack zone list | grep "$(echo $CLUSTER_NAME | rev | cut -d. -f1-2 | rev)"

Type guard

func zoneMatchesCluster(zoneName, clusterName string) bool { return strings.HasSuffix(clusterName, strings.TrimSuffix(zoneName, ".")) }

Try / catch

zs, err := os.osCloud.ListDNSZones(zones.ListOpts{})
if err != nil { return nil, err }
var clusterZone zones.Zone
for _, z := range zs { if zoneMatchesCluster(z.Name, os.clusterName) { clusterZone = z; break } }
if clusterZone.ID == "" { return nil, fmt.Errorf("failed to find cluster dns zone for %s", os.clusterName) }

Prevention

When it happens

Trigger: No Designate zone name matches the cluster name suffix: zone was deleted/renamed, clusterName doesn't match the zone (e.g., trailing-dot handling or different domain), or the zone lives in a different OpenStack project.

Common situations: Cluster created under example.com but that zone was removed from Designate; cluster name using a subdomain that isn't itself a zone; wrong OS_PROJECT_NAME so the zone isn't visible; zone renamed after cluster creation.

Related errors


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