kubernetes/kops · error

dns provider %T does not support zones

Error message

dns provider %T does not support zones

What it means

FindDNSHostedZone obtains the zone-listing capability from the configured DNS provider via dns.Zones(). The dnsprovider.Interface contract says the bool result is false when the provider cannot list zones. kops needs zone enumeration to match the cluster DNS name to a hosted zone, so a provider without zone support fails here.

Source

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

		if err != nil {
			return nil, fmt.Errorf("error initializing Akamai (Linode) cloud: %w", err)
		}

		cloud = linodeCloud
	default:
		return nil, fmt.Errorf("unknown CloudProvider %q", cluster.GetCloudProvider())
	}
	return cloud, nil
}

func FindDNSHostedZone(dns dnsprovider.Interface, clusterDNSName string, dnsType kops.DNSType) (string, error) {
	klog.V(2).Infof("Querying for all DNS zones to find match for %q", clusterDNSName)

	clusterDNSName = "." + strings.TrimSuffix(clusterDNSName, ".")

	zonesProvider, ok := dns.Zones()
	if !ok {
		return "", fmt.Errorf("dns provider %T does not support zones", dns)
	}

	allZones, err := zonesProvider.List()
	if err != nil {
		return "", fmt.Errorf("error querying zones: %v", err)
	}

	var zones []dnsprovider.Zone
	for _, z := range allZones {
		zoneName := "." + strings.TrimSuffix(z.Name(), ".")

		if !strings.HasSuffix(clusterDNSName, zoneName) {
			continue
		}

		if dnsType != "" {
			if awsZone, ok := z.(*route53.Zone); ok {
				hostedZone := awsZone.Route53HostedZone()

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use a supported external-DNS provider (aws/route53, gcloud/dns, azure) in cluster.spec so dns.Zones() is backed by a real implementation.
  2. If gossip is intended, do not route through FindDNSHostedZone — configure kopsModelContext to skip hosted-zone lookup for gossip clusters.
  3. If writing custom code against dnsprovider.Interface, verify `zones, ok := dns.Zones(); ok` before calling List.

Example fix

// before
id, err := FindDNSHostedZone(provider, name, dnsType) // provider has no zones
// after
if zones, ok := provider.Zones(); !ok {
    return fmt.Errorf("provider %T cannot list zones", provider)
}
id, err := FindDNSHostedZone(provider, name, dnsType)
Defensive patterns

Strategy: type-guard

Type guard

zonesProvider, ok := dns.Zones()
if !ok {
    return fmt.Errorf("dns provider %T does not support zone listing", dns)
}

Prevention

When it happens

Trigger: Calling FindDNSHostedZone (via the update/create run path) with a dnsprovider.Interface implementation whose Zones() returns (nil, false) — e.g. a stub or unsupported provider such as a gossip-based provider being asked for hosted zones, or a misconfigured DNS provider plugin.

Common situations: Using gossip DNS but expecting hosted-zone discovery; a DNS provider built without its zone-listing backend (e.g. missing cloud credentials cause the provider to report no zone support); custom/embedded kops controller code passing a minimal fake provider.

Related errors


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