{"record":{"id":"1eee8b40a5ca02cb","repo":"kubernetes/kops","slug":"no-matching-hosted-zones-found-for-q-please-crea","errorCode":null,"errorMessage":"No matching hosted zones found for %q; please create one (e.g. %q) first","messagePattern":"No matching hosted zones found for %q; please create one \\(e\\.g\\. %q\\) first","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/utils.go","lineNumber":301,"sourceCode":"\t\tif n < maxLength {\n\t\t\tcontinue\n\t\t}\n\n\t\tif n > maxLength {\n\t\t\tmaxLength = n\n\t\t\tmaxLengthZones = []dnsprovider.Zone{}\n\t\t}\n\n\t\tmaxLengthZones = append(maxLengthZones, z)\n\t}\n\n\tif len(maxLengthZones) == 0 {\n\t\t// We make this an error because you have to set up DNS delegation anyway\n\t\ttokens := strings.Split(clusterDNSName, \".\")\n\t\tsuffix := strings.Join(tokens[len(tokens)-2:], \".\")\n\t\t// klog.Warningf(\"No matching hosted zones found; will created %q\", suffix)\n\t\t// return suffix, nil\n\t\treturn \"\", fmt.Errorf(\"No matching hosted zones found for %q; please create one (e.g. %q) first\", clusterDNSName, suffix)\n\t}\n\n\tif len(maxLengthZones) == 1 {\n\t\tid := maxLengthZones[0].ID()\n\t\tid = strings.TrimPrefix(id, \"/hostedzone/\")\n\t\treturn id, nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"Found multiple hosted zones matching cluster %q; please specify the ID of the zone to use\", clusterDNSName)\n}\n","sourceCodeStart":283,"sourceCodeEnd":312,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/utils.go#L283-L312","documentation":"FindDNSHostedZone filters listed zones to those whose name is a suffix of the cluster DNS name, keeping the longest matches. If no existing hosted zone matches the cluster's domain at all, kops refuses to proceed because DNS delegation must be set up manually; the error suggests the registrable parent domain (last two labels) to create.","triggerScenarios":"`kops create cluster` or `update cluster` where the cluster DNS name (e.g. cluster.example.com) has no hosted zone covering example.com or cluster.example.com in the configured DNS account/provider.","commonSituations":"Fresh AWS account with no Route53 zone created for the domain; zone exists in a different AWS account than the credentials used; private vs public zone mismatch; typo in --name / cluster DNS name; using gossip-free setup without ever registering the domain.","solutions":["Create a hosted zone for the parent domain, e.g. `aws route53 create-hosted-zone --name example.com --caller-reference $(uuidgen)`, then add NS records at your registrar.","Or create a zone matching the cluster subdomain exactly (cluster.example.com).","Double-check the cluster --name matches the domain you actually control and that credentials point at the account owning the zone."],"exampleFix":"// before (no zone exists)\nkops create cluster --name cluster.example.com ...\n// after\naws route53 create-hosted-zone --name example.com --caller-reference ref-123\nkops create cluster --name cluster.example.com ...","handlingStrategy":"validation","validationCode":"id, err := findZoneID(clusterDNSName) // pre-check zone exists via provider API before kops\nif err != nil { createHostedZone(parentDomain(clusterDNSName)) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create the hosted zone for the cluster's parent domain before `kops create cluster`.","Keep cluster --name inside a domain you control in the same account kops authenticates to.","Store the zone ID in cluster.spec.dnsZone to make lookups deterministic."],"tags":["dns","route53","hosted-zone","prerequisite"],"backgroundTag":"no-matching-hosted-zone","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"}