kubernetes/kops · error

error getting DNS zones provider

Error message

error getting DNS zones provider

What it means

After building the DNS provider, findZone calls dns.Zones() which returns (ZonesProvider, bool). The bool is false when the dnsprovider implementation does not support zone enumeration; kOps then fails with 'error getting DNS zones provider'. This is an interface-capability check, not an API failure.

Source

Thrown at upup/pkg/fi/cloudup/dns.go:57

)

type recordKey struct {
	hostname string
	rrsType  rrstype.RrsType
}

func findZone(cluster *kops.Cluster, cloud fi.Cloud) (dnsprovider.Zone, error) {
	dns, err := cloud.DNS()
	if err != nil {
		return nil, fmt.Errorf("error building DNS provider: %v", err)
	}
	if dns == nil {
		return nil, nil
	}

	zonesProvider, ok := dns.Zones()
	if !ok {
		return nil, fmt.Errorf("error getting DNS zones provider")
	}

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

	var matches []dnsprovider.Zone
	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)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use a DNS provider supported by kOps for zone enumeration (Route53, Google Cloud DNS, Azure DNS)
  2. Verify the correct dnsprovider plugin/driver is registered for your cloud
  3. Check kOps version compatibility with the chosen DNS provider and upgrade if needed

Example fix

// before
spec:
  dnsZone: "unsupported-dns.example"
// after: switch cluster DNS to a supported provider, e.g.
spec:
  dnsZone: "example.com"  # hosted in Route53/Azure DNS/Cloud DNS
Defensive patterns

Strategy: type-guard

Validate before calling

dns, err := cloud.DNS()
if err != nil || dns == nil {
    return errors.New("cloud does not provide a DNS provider")
}
if _, ok := dns.Zones(); !ok {
    return errors.New("DNS provider does not support zone listing")
}

Type guard

func supportsZoneListing(d dnsprovider.Interface) bool {
    _, ok := d.Zones()
    return ok
}

Prevention

When it happens

Trigger: findZone on a DNS provider whose Zones() reports unsupported — e.g. a dnsprovider plugin/implementation lacking the Zones interface, or a cloud DNS driver that only supports record management without zone listing.

Common situations: Using a DNS provider integration that does not implement zone listing; misconfigured driver registration so the wrong dnsprovider implementation is selected; custom/older dnsprovider builds.

Related errors


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