kubernetes/kops · error

error building DNS provider: %v

Error message

error building DNS provider: %v

What it means

findZone obtains a DNS provider from the fi.Cloud via cloud.DNS(). If the cloud implementation cannot build its DNS provider (misconfigured DNS integration, unsupported provider combination), the error is wrapped as 'error building DNS provider' and zone lookup fails during cluster validation or DNS pre-creation.

Source

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

	kopsdns "k8s.io/kops/pkg/dns"
	"k8s.io/kops/upup/pkg/fi"
)

const (
	PlaceholderTTL = 10
	// DigitalOcean's DNS servers require a certain minimum TTL (it's 30), keeping 60 here.
	PlaceholderTTLDigitialOcean = 60
)

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 {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped cause (%v) to see why cloud.DNS() failed and fix credentials/config for the DNS provider
  2. Ensure the cluster's cloud provider supports the configured DNS setup (e.g. route53 for AWS)
  3. If the cloud intentionally has no DNS support, configure a supported dnsZone/provider or skip DNS-dependent flow
  4. Update kOps if your provider's DNS support was added later than your binary

Example fix

// before (GCP cluster lacking DNS config)
spec:
  dnsZone: ""
// after
spec:
  dnsZone: "example-gcp-zone"
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify cloud DNS support before running cluster ops
if cloud.ProviderID() == kops.CloudProviderAzure && cluster.Spec.DNSZone == "" {
    return errors.New("dnsZone must be set for this provider")
}

Try / catch

zone, err := findZone(cluster, cloud)
if err != nil {
    return fmt.Errorf("DNS setup failed: %w", err) // inspect wrapped cause for cloud.DNS() failure
}

Prevention

When it happens

Trigger: validateDNS or precreateDNS calling findZone on a cloud whose DNS() returns an error — e.g. Azure/GCP/OpenStack cloud with DNS support not wired, or credentials/clients failing to initialize for the DNS service.

Common situations: Cloud provider implementations where DNS() is unimplemented or fails client initialization; missing cloud credentials preventing DNS client construction; using a cloud where kOps DNS integration is disabled.

Related errors


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