{"record":{"id":"5beec737db7960f8","repo":"kubernetes/kops","slug":"unknown-dnstype-q","errorCode":null,"errorMessage":"unknown DNSType: %q","messagePattern":"unknown DNSType: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":1537,"sourceCode":"\nfunc setupDNSTopology(opt *NewClusterOptions, cluster *api.Cluster) error {\n\tswitch strings.ToLower(opt.DNSType) {\n\tcase \"\":\n\t\tif opt.DNSZone != \"\" {\n\t\t\t// Use dns=public if zone is specified\n\t\t\tcluster.Spec.Networking.Topology.DNS = api.DNSTypePublic\n\t\t} else {\n\t\t\t// Default to dns=none instead of dns=public for all cloud providers\n\t\t\tcluster.Spec.Networking.Topology.DNS = api.DNSTypeNone\n\t\t}\n\tcase \"public\":\n\t\tcluster.Spec.Networking.Topology.DNS = api.DNSTypePublic\n\tcase \"private\":\n\t\tcluster.Spec.Networking.Topology.DNS = api.DNSTypePrivate\n\tcase \"none\":\n\t\tcluster.Spec.Networking.Topology.DNS = api.DNSTypeNone\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown DNSType: %q\", opt.DNSType)\n\t}\n\treturn nil\n}\n\nfunc setupAPI(opt *NewClusterOptions, cluster *api.Cluster) error {\n\t// Populate the API access, so that it can be discoverable\n\tklog.Infof(\"Cloud Provider ID: %q\", cluster.GetCloudProvider())\n\tif opt.APILoadBalancerType != \"\" || opt.APISSLCertificate != \"\" {\n\t\tcluster.Spec.API.LoadBalancer = &api.LoadBalancerAccessSpec{}\n\t} else {\n\t\tswitch opt.Topology {\n\t\tcase api.TopologyPublic:\n\t\t\tif cluster.UsesNoneDNS() {\n\t\t\t\t// there are no DNS records for the API, so we use a LoadBalancer instead\n\t\t\t\tcluster.Spec.API.LoadBalancer = &api.LoadBalancerAccessSpec{}\n\t\t\t} else {\n\t\t\t\tcluster.Spec.API.DNS = &api.DNSAccessSpec{}\n\t\t\t}","sourceCodeStart":1519,"sourceCodeEnd":1555,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L1519-L1555","documentation":"setupDNSTopology maps the --dns flag to a DNSType in the cluster spec. Only \"public\", \"private\", and \"none\" are accepted; any other value hits the default branch and returns this error quoting the provided string.","triggerScenarios":"`kops create cluster --dns <value>` with a value outside {public, private, none}, e.g. --dns Public (case-sensitive), --dns \"\", or --dns aws from a misremembered option.","commonSituations":"Case mistakes (Public/Private); empty --dns from unset environment variables; assuming other DNS modes exist; old scripts using removed values.","solutions":["Pass --dns public, --dns private, or --dns none (lowercase).","Remove the --dns flag to use the default.","Fix the shell variable feeding the flag so it expands to a valid value."],"exampleFix":"// before\nkops create cluster my.cluster --dns Public\n// after\nkops create cluster my.cluster --dns public","handlingStrategy":"validation","validationCode":"case \"$DNS\" in public|private|none|\"\") ;; *) echo \"--dns must be public|private|none\"; exit 1;; esac","typeGuard":null,"tryCatchPattern":"if err := createCluster(); err != nil && strings.Contains(err.Error(), \"unknown DNSType\") { /* fix --dns value (lowercase) and retry */ }","preventionTips":["Use lowercase dns values","Omit --dns to take the default","Avoid case-sensitive values in shared scripts"],"tags":["dns","cli-flags","topology","cluster-creation"],"backgroundTag":"invalid-flag-value","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"}