{"record":{"id":"af572bc4a6e35762","repo":"kubernetes/kops","slug":"error-determining-default-dns-zone-v","errorCode":null,"errorMessage":"error determining default DNS zone: %v","messagePattern":"error determining default DNS zone: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/populate_cluster_spec.go","lineNumber":274,"sourceCode":"\n\tif cluster.Spec.API.LoadBalancer != nil && cluster.Spec.API.LoadBalancer.Class == \"\" && cluster.Spec.CloudProvider.AWS != nil {\n\t\tcluster.Spec.API.LoadBalancer.Class = kopsapi.LoadBalancerClassClassic\n\t}\n\n\tif cluster.Spec.DNSZone == \"\" && cluster.PublishesDNSRecords() {\n\t\tdns, err := cloud.DNS()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif dns != nil {\n\t\t\tdnsType := kopsapi.DNSTypePublic\n\t\t\tif cluster.Spec.Networking.Topology != nil && cluster.Spec.Networking.Topology.DNS != \"\" {\n\t\t\t\tdnsType = cluster.Spec.Networking.Topology.DNS\n\t\t\t}\n\n\t\t\tdnsZone, err := FindDNSHostedZone(dns, cluster.ObjectMeta.Name, dnsType)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error determining default DNS zone: %v\", err)\n\t\t\t}\n\n\t\t\tklog.V(2).Infof(\"Defaulting DNS zone to: %s\", dnsZone)\n\t\t\tcluster.Spec.DNSZone = dnsZone\n\t\t}\n\t}\n\n\tif !cluster.UsesNoneDNS() {\n\t\tif cluster.Spec.DNSZone != \"\" && cluster.Spec.API.PublicName == \"\" {\n\t\t\tcluster.Spec.API.PublicName = \"api.\" + cluster.Name\n\t\t}\n\t\tif cluster.Spec.ExternalDNS == nil {\n\t\t\tcluster.Spec.ExternalDNS = &kopsapi.ExternalDNSConfig{}\n\t\t}\n\t\tif cluster.Spec.ExternalDNS.Provider == \"\" {\n\t\t\tcluster.Spec.ExternalDNS.Provider = kopsapi.ExternalDNSProviderDNSController\n\t\t}\n\t}","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/populate_cluster_spec.go#L256-L292","documentation":"When spec.dnsZone is empty and the cluster publishes DNS records, kops asks the cloud's DNS service to find a hosted zone matching the cluster name. Failure of FindDNSHostedZone is wrapped in this error — usually no matching zone exists or the DNS API call failed.","triggerScenarios":"PopulateClusterSpec with an empty spec.dnsZone on a cloud with DNS (e.g. AWS Route53) where the cluster name (e.g. cluster.example.com) has no hosted zone, credentials lack route53:ListHostedZones, or the API call errors (throttling, region issues).","commonSituations":"Cluster name whose parent domain has no hosted zone in the account; IAM policy missing Route53 permissions; multi-account setups where the zone lives in a different AWS account; private DNS topology mismatch (private zone requested but only a public zone exists).","solutions":["Create a hosted zone matching the cluster name's parent domain in the same cloud account, then retry.","Explicitly set spec.dnsZone (or --dns-zone) to the existing zone name so kops skips discovery.","Verify cloud credentials/IAM include DNS read permissions (e.g. route53:ListHostedZones) and inspect the wrapped %v error for the root cause."],"exampleFix":"# before\nkops create cluster --name cluster.example.com  # no example.com zone in account\n# after\nkops create cluster --name cluster.example.com --dns-zone example.com","handlingStrategy":"try-catch","validationCode":"if cluster.Spec.DNSZone == \"\" {\n\t// Ensure a hosted zone exists for the cluster name's parent domain before creating\n\t// e.g. aws route53 list-hosted-zones-by-name --dns-name example.com\n}","typeGuard":null,"tryCatchPattern":"dnsZone, err := FindDNSHostedZone(dns, cluster.ObjectMeta.Name, dnsType)\nif err != nil {\n\treturn fmt.Errorf(\"no hosted zone found for %q; create one or pass --dns-zone: %w\", cluster.ObjectMeta.Name, err)\n}","preventionTips":["Create the parent domain hosted zone before `kops create cluster`","Always pass --dns-zone when multiple zones or accounts could match","Grant cloud credentials DNS list permissions (route53:ListHostedZones)"],"tags":["dns","route53","cluster-creation"],"backgroundTag":"dns-zone-lookup-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}