字符串。如果您希望 Google 网域解析为专用访问 IP 地址,请将此规范设置为 "private"。如果您希望 Google 网域解析为受限访问 IP 地址,请将此规范设置为 restricted。如果您不希望对 Google 网域进行任何特殊处理,请将此规范设置为 default 或将其移除。如需了解详情,请参阅为本地主机配置专用 Google 访问通道。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-26。"],[],[],null,["This document shows how to configure DNS for an admin cluster or user cluster.\n\nThe DNS configuration for a cluster is held in a ClusterDNS custom resource\nnamed `default`. This is a cluster-wide resource; that is, it is not\nnamespaced.\n\nView the ClusterDNS resource\n\nTo view the ClusterDNS resource:\n\n```\nkubectl --kubeconfig CLUSTER_KUBECONFIG get clusterdns default --output yaml\n```\n\nReplace \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e with the path of the cluster kubeconfig\nfile.\n\nThe DNS configuration is in the `spec` section. If the `spec` section is empty\nor missing, then the cluster uses a default Kubernetes CoreDNS configuration.\n\nChange the DNS configuration\n\nCreate a manifest for a ClusterDNS resource named `default`. Fill in the `spec`\nas desired. For example:\n\n```\napiVersion: networking.gke.io/v1alpha1\nkind: ClusterDNS\nmetadata:\n name: default\nspec:\n upstreamNameservers:\n - serverIP: 8.8.8.8\n - serverIP: 8.8.4.4\n domains:\n - name: altostrat.com\n nameservers:\n - serverIP: 198.51.100.1\n - name: my-own-personal-domain.com\n nameservers:\n - serverIP: 203.0.113.1\n - serverIP: 203.0.113.2\n serverPort: 54\n googleAccess: private\n```\n\nSave the manifest to a file named `my-dns.yaml` and apply the resource to the\ncluster:\n\n```\nkubectl --kubeconfig CLUSTER_KUBECONFIG apply -f my-dns.yaml\n```\n\nThe ClusterDNS spec\n\n`spec.upstreamNameservers`\n\nAn array of objects, each of which has a server IP address and optionally a\nserver port. The default value for the server port is 53.\n\nThe default upstream name servers. Requests for non-cluster domains are forwarded\nto this set of servers by default. For example:\n\n```\nspec:\n upstreamNameservers:\n - serverIP: 8.8.8.8\n - serverIP: 1.2.3.4\n serverPort: 54\n```\n\nIf you do not specify any values for `upstreamNameservers`, then the DNS\nprovider uses the `/etc/resolv.conf` file on the node to find the list of\nupstream name servers.\n\n`spec.domains`\n\nConfiguration for specific domains. This allows overriding of the configuration\nin `upstreamNameservers`.\n\nYou can use this section to configure different upstream name servers for\nparticular domains, separately from the default upstream name servers.\n\nYou can also turn on query logging for a domain. You can do this for any\nspecified domain or the cluster domain, cluster.local.\n\nFor example:\n\n```\nspec:\n domains:\n - name: altostrat.com\n nameservers:\n - serverIP: 198.51.100.1\n - name: my-own-personal-domain.com\n nameservers:\n - serverIP: 203.0.113.1\n - serverIP: 203.0.113.2\n serverPort: 50000\n - name: cluster.local\n queryLogging: true\n```\n\n`spec.googleAccess`\n\nString. If you want Google domains to resolve to private-access IP addresses,\nset this to `\"private\"`. If you want Google domains to resolve to\nrestricted-access IP addresses, set this to `restricted`. If you want no special\ntreatment for Google domains, set this to `default` or remove it. For more\ninformation, see\n[Configuring Private Google Access for on-premises hosts](/vpc/docs/configure-private-google-access-hybrid).\n\nFor example:\n\n```\nspec:\n googleAccess: private\n```\n\n`spec.orderPolicy`\n\nString. If you want to specify the ordering policy by which upstream servers are\nselected. Default is `\"random\"`. Supported types are `\"random\"`,`\"round_robin\"`\nand `\"sequential\"`. Note that this ordering policy will apply to defined domains\nas well. See the [coredns](https://coredns.io/plugins/forward/) docs for more\ninfo about `policy` and what each configuration does.\n\nFor example:\n\n```\nspec:\n orderPolicy: sequential\n```\n\n\u003cbr /\u003e"]]