You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sync web page for part of the items in umbrella issue:
[zh] Umbrella issue: pages out of sync in tasks section #26178
content/zh/docs/tasks/administer-cluster/nodelocaldns.md
This page provides an overview of NodeLocal DNSCache feature in Kubernetes.
21
22
-->
@@ -103,57 +104,107 @@ This is the path followed by DNS Queries after NodeLocal DNSCache is enabled:
103
104
## Configuration
104
105
-->
105
106
## 配置
106
-
107
107
<!--
108
-
This feature can be enabled using the command:
108
+
{{< note >}} The local listen IP address for NodeLocal DNSCache can be any address that can be guaranteed to not collide with any existing IP in your cluster. It's recommended to use an address with a local scope, per example, from the link-local range 169.254.0.0/16 for IPv4 or from the Unique Local Address range in IPv6 fd00::/8.
109
+
{{< /note >}}
109
110
-->
110
-
可以使用以下命令启用此功能:
111
-
112
-
`KUBE_ENABLE_NODELOCAL_DNS=true go run hack/e2e.go -v --up`
111
+
{{< note >}}
112
+
NodeLocal DNSCache 的本地侦听 IP 地址可以是任何地址,只要该地址不和你的集群里现有的 IP 地址发生冲突。
113
+
推荐使用本地范围内的地址,例如,IPv4 链路本地区段 169.254.0.0/16 内的地址,
114
+
或者 IPv6 唯一本地地址区段 fd00::/8 内的地址。
115
+
{{< /note >}}
113
116
114
117
<!--
115
-
This works for e2e clusters created on GCE. On all other environments, the following steps will setup NodeLocal DNSCache:
118
+
This feature can be enabled using the following steps:
116
119
-->
117
-
这适用于在 GCE 上创建 e2e 集群。
118
-
在所有其他环境上,以下步骤将设置 NodeLocal DNSCache :
120
+
可以使用以下步骤启动此功能:
119
121
120
122
<!--
121
-
* A yaml similar to [this](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml) can be applied using `kubectl create -f` command.
123
+
* Prepare a manifest similar to the sample [`nodelocaldns.yaml`](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml) and save it as `nodelocaldns.yaml.`
* --cluster-dns flag to kubelet needs to be modified to use the LOCAL_DNS IP that NodeLocal DNSCache is listening on (169.254.20.10 by default)
128
+
* If using IPv6, the CoreDNS configuration file need to enclose all the IPv6 addresses into square brackets if used in IP:Port format.
129
+
If you are using the sample manifest from the previous point, this will require to modify [the configuration line L70](https://github.com/kubernetes/kubernetes/blob/b2ecd1b3a3192fbbe2b9e348e095326f51dc43dd/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml#L70) like this `health [__PILLAR__LOCAL__DNS__]:8080`
Once enabled, node-local-dns Pods will run in the kube-system namespace on each of the cluster nodes. This Pod runs [CoreDNS](https://github.com/coredns/coredns) in cache mode, so all CoreDNS metrics exposed by the different plugins will be available on a per-node basis.
135
+
* Substitute the variables in the manifest with the right values:
136
+
137
+
* kubedns=`kubectl get svc kube-dns -n kube-system -o jsonpath={.spec.clusterIP}`
138
+
139
+
* domain=`<cluster-domain>`
140
+
141
+
* localdns=`<node-local-address>`
142
+
143
+
`<cluster-domain>` is "cluster.local" by default. `<node-local-address>` is the local listen IP address chosen for NodeLocal DNSCache.
此 Pod 在缓存模式下运行 [CoreDNS](https://github.com/coredns/coredns) ,因此每个节点都可以使用不同插件公开的所有 CoreDNS 指标。
145
+
* 把清单里的变量更改为正确的值:
146
+
* kubedns=`kubectl get svc kube-dns -n kube-system -o jsonpath={.spec.clusterIP}`
147
+
148
+
* domain=`<cluster-domain>`
149
+
150
+
* localdns=`<node-local-address>`
151
+
152
+
`<cluster-domain>` 的默认值是 "cluster.local"。 `<node-local-address>` 是 NodeLocal DNSCache 选择的本地侦听 IP 地址。
135
153
136
154
<!--
137
-
### Feature availability
138
-
-->
139
-
### 功能可用性
155
+
* If kube-proxy is running in IPTABLES mode:
156
+
157
+
``` bash
158
+
sed -i "s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/__PILLAR__DNS__SERVER__/$kubedns/g" nodelocaldns.yaml
159
+
```
140
160
161
+
`__PILLAR__CLUSTER__DNS__` and `__PILLAR__UPSTREAM__SERVERS__` will be populated by the node-local-dns pods.
162
+
In this mode, node-local-dns pods listen on both the kube-dns service IP as well as `<node-local-address>`, so pods can lookup DNS records using either IP address.
163
+
-->
164
+
* 如果 kube-proxy 运行在 IPTABLES 模式:
165
+
166
+
```bash
167
+
sed -i "s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/__PILLAR__DNS__SERVER__/$kubedns/g" nodelocaldns.yaml
在此模式下, node-local-dns Pods 会同时侦听 kube-dns 服务的 IP 地址和 `<node-local-address>` 的地址,
172
+
以便 Pods 可以使用其中任何一个 IP 地址来查询 DNS 记录。
141
173
<!--
142
-
The addon can be applied using the yaml specified above in any k8s version. The feature support is as described:
174
+
* If kube-proxy is running in IPVS mode:
175
+
176
+
``` bash
177
+
sed -i "s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/__PILLAR__DNS__SERVER__//g; s/__PILLAR__CLUSTER__DNS__/$kubedns/g" nodelocaldns.yaml
178
+
```
179
+
In this mode, node-local-dns pods listen only on `<node-local-address>`. The node-local-dns interface cannot bind the kube-dns cluster IP since the interface used for IPVS loadbalancing already uses this address.
180
+
`__PILLAR__UPSTREAM__SERVERS__` will be populated by the node-local-dns pods.
143
181
-->
144
-
可以在任何 K8s 版本中使用上面指定的 yaml 应用该插件。
145
-
功能支持如下所述:
182
+
* 如果 kube-proxy 运行在 IPVS 模式:
146
183
184
+
``` bash
185
+
sed -i "s/__PILLAR__LOCAL__DNS__/$localdns/g; s/__PILLAR__DNS__DOMAIN__/$domain/g; s/__PILLAR__DNS__SERVER__//g; s/__PILLAR__CLUSTER__DNS__/$kubedns/g" nodelocaldns.yaml
* If using kube-proxy in IPVS mode, `--cluster-dns` flag to kubelet needs to be modified to use `<node-local-address>` that NodeLocal DNSCache is listening on.
196
+
Otherwise, there is no need to modify the value of the `--cluster-dns` flag, since NodeLocal DNSCache listens on both the kube-dns service IP as well as `<node-local-address>`.
Once enabled, node-local-dns Pods will run in the kube-system namespace on each of the cluster nodes. This Pod runs [CoreDNS](https://github.com/coredns/coredns) in cache mode, so all CoreDNS metrics exposed by the different plugins will be available on a per-node basis.
157
204
158
-
205
+
You can disable this feature by removing the DaemonSet, using `kubectl delete -f <manifest>`. You should also revert any changes you made to the kubelet configuration.
0 commit comments