@@ -96,7 +96,7 @@ options ndots:5
96
96
In summary, a Pod in the _test_ namespace can successfully resolve either
97
97
`data.prod` or `data.prod.svc.cluster.local`.
98
98
-->
99
- 概括起来,命名空间 _ test _ 中的 Pod 可以成功地解析 ` data.prod ` 或者
99
+ 概括起来,命名空间 ** test ** 中的 Pod 可以成功地解析 ` data.prod ` 或者
100
100
` data.prod.svc.cluster.local ` 。
101
101
102
102
<!--
@@ -112,8 +112,8 @@ What objects get DNS records?
112
112
113
113
哪些对象会获得 DNS 记录呢?
114
114
115
- 1 . Services
116
- 2 . Pods
115
+ 1 . Service
116
+ 2 . Pod
117
117
118
118
<!--
119
119
The following sections detail the supported DNS record types and layout that is
@@ -149,7 +149,7 @@ selection from the set.
149
149
150
150
#### A/AAAA 记录 {#a-aaaa-records}
151
151
152
- 除了无头 Service 之外的 “普通” Service 会被赋予一个形如 ` my-svc.my-namespace.svc.cluster-domain.example `
152
+ 除了无头 Service 之外的“普通” Service 会被赋予一个形如 ` my-svc.my-namespace.svc.cluster-domain.example `
153
153
的 DNS A 和/或 AAAA 记录,取决于 Service 的 IP 协议族(可能有多个)设置。
154
154
该名称会解析成对应 Service 的集群 IP。
155
155
@@ -171,7 +171,6 @@ services.
171
171
- For a headless Service, this resolves to multiple answers, one for each Pod
172
172
that is backing the Service, and contains the port number and the domain name of the Pod
173
173
of the form `hostname.my-svc.my-namespace.svc.cluster-domain.example`.
174
-
175
174
-->
176
175
#### SRV 记录 {#srv-records}
177
176
@@ -193,39 +192,49 @@ Kubernetes 根据普通 Service 或无头 Service 中的命名端口创建 SRV
193
192
Kube-DNS versions, prior to the implementation of the
194
193
[DNS specification](https://github.com/kubernetes/dns/blob/master/docs/specification.md),
195
194
had the following DNS resolution:
195
+ -->
196
+ ### A/AAAA 记录 {#a-aaaa-records}
197
+
198
+ 在实现 [ DNS 规范] ( https://github.com/kubernetes/dns/blob/master/docs/specification.md ) 之前,
199
+ Kube-DNS 版本使用以下 DNS 解析:
196
200
197
201
```
198
- pod-ipv4 -address.my- namespace.pod.cluster-domain.example
202
+ < pod-IPv4 -address>.< namespace> .pod.< cluster-domain>
199
203
```
200
204
205
+ <!--
201
206
For example, if a Pod in the `default` namespace has the IP address 172.17.0.3,
202
207
and the domain name for your cluster is `cluster.local`, then the Pod has a DNS name:
208
+ -->
209
+ 例如,对于一个位于 ` default ` 命名空间,IP 地址为 172.17.0.3 的 Pod,
210
+ 如果集群的域名为 ` cluster.local ` ,则 Pod 会对应 DNS 名称:
203
211
204
212
```
205
213
172-17-0-3.default.pod.cluster.local
206
214
```
207
215
216
+ <!--
208
217
Some cluster DNS mechanisms, like [CoreDNS](https://coredns.io/), also provide `A` records for:
218
+ -->
219
+ 一些集群 DNS 机制(如 [ CoreDNS] ( https://coredns.io/ ) )还会为以下内容提供 ` A ` 记录:
209
220
210
221
```
211
222
<pod-ipv4-address>.<service-name>.<my-namespace>.svc.<cluster-domain.example>
212
223
```
213
- -->
214
- ### A/AAAA 记录 {#a-aaaa-records}
215
-
216
- 在实现 [ DNS 规范] ( https://github.com/kubernetes/dns/blob/master/docs/specification.md ) 之前,
217
- Kube-DNS 版本使用以下 DNS 解析:
218
224
219
- ` pod-ipv4-address.my-namespace.pod.cluster-domain.example `
220
-
221
- 例如,对于一个位于 ` default ` 命名空间,IP 地址为 172.17.0.3 的 Pod,
222
- 如果集群的域名为 ` cluster.local ` ,则 Pod 会对应 DNS 名称:
223
-
224
- ` 172-17-0-3.default.pod.cluster.local `
225
-
226
- 一些集群 DNS 机制(如 [ CoreDNS] ( https://coredns.io/ ) )还会为以下内容提供 ` A ` 记录:
225
+ <!--
226
+ For example, if a Pod in the `cafe` namespace has the IP address 172.17.0.3,
227
+ is an endpoint of a Service named `barista`, and the domain name for your cluster is
228
+ `cluster.local`, then the Pod would have this service-scoped DNS `A` record.
229
+ -->
230
+ 例如,如果 ` cafe ` 命名空间中的一个 Pod 拥有 IP 地址
231
+ 172.17.0.3(是名为 ` barista ` 的服务的端点),
232
+ 并且集群的域名是 ` cluster.local ` ,
233
+ 那么此 Pod 将拥有这样的服务范围的 DNS A 记录:
227
234
228
- ` <pod-ipv4-address>.<service-name>.<my-namespace>.svc.<cluster-domain.example>. `
235
+ ```
236
+ 172-17-0-3.barista.cafe.svc.cluster.local
237
+ ```
229
238
230
239
<!--
231
240
### Pod's hostname and subdomain fields
@@ -275,6 +284,53 @@ Example:
275
284
276
285
示例:
277
286
287
+ <!--
288
+ ```yaml
289
+ apiVersion: v1
290
+ kind: Service
291
+ metadata:
292
+ name: busybox-subdomain
293
+ spec:
294
+ selector:
295
+ name: busybox
296
+ clusterIP: None
297
+ ports:
298
+ - name: foo # name is not required for single-port Services
299
+ port: 1234
300
+ ---
301
+ apiVersion: v1
302
+ kind: Pod
303
+ metadata:
304
+ name: busybox1
305
+ labels:
306
+ name: busybox
307
+ spec:
308
+ hostname: busybox-1
309
+ subdomain: busybox-subdomain
310
+ containers:
311
+ - image: busybox:1.28
312
+ command:
313
+ - sleep
314
+ - "3600"
315
+ name: busybox
316
+ ---
317
+ apiVersion: v1
318
+ kind: Pod
319
+ metadata:
320
+ name: busybox2
321
+ labels:
322
+ name: busybox
323
+ spec:
324
+ hostname: busybox-2
325
+ subdomain: busybox-subdomain
326
+ containers:
327
+ - image: busybox:1.28
328
+ command:
329
+ - sleep
330
+ - "3600"
331
+ name: busybox
332
+ ```
333
+ -->
278
334
``` yaml
279
335
apiVersion : v1
280
336
kind : Service
@@ -328,8 +384,8 @@ to `"busybox-subdomain"`, the first Pod will see its own FQDN as
328
384
A and/or AAAA records at that name, pointing to the Pod's IP. Both Pods "`busybox1`" and
329
385
" `busybox2`" will have their own address records.
330
386
-->
331
- 鉴于上述服务 `“ busybox-subdomain”` 和将 `spec.subdomain` 设置为 `“ busybox-subdomain” ` 的 Pod,
332
- 第一个 Pod 将看到自己的 FQDN 为 `“ busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example” `。
387
+ 鉴于上述 `" busybox-subdomain"` Service 和将 `spec.subdomain` 设置为 `" busybox-subdomain" ` 的 Pod,
388
+ 第一个 Pod 将看到自己的 FQDN 为 `" busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example" `。
333
389
DNS 会为此名字提供一个 A 记录和/或 AAAA 记录,指向该 Pod 的 IP。
334
390
Pod “`busybox1`” 和 “`busybox2`” 都将有自己的地址记录。
335
391
@@ -372,7 +428,7 @@ then by default the `hostname` command inside that Pod returns `busybox-1` and t
372
428
373
429
When you set `setHostnameAsFQDN : true` in the Pod spec, the kubelet writes the Pod's FQDN into the hostname for that Pod's namespace. In this case, both `hostname` and `hostname --fqdn` return the Pod's FQDN.
374
430
-->
375
- 当 Pod 配置为具有全限定域名 ( FQDN) 时,其主机名是短主机名。
431
+ 当 Pod 配置为具有全限定域名( FQDN) 时,其主机名是短主机名。
376
432
例如,如果你有一个具有完全限定域名 `busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example` 的 Pod,
377
433
则默认情况下,该 Pod 内的 `hostname` 命令返回 `busybox-1`,而 `hostname --fqdn` 命令返回 FQDN。
378
434
@@ -660,4 +716,4 @@ For guidance on administering DNS configurations, check
660
716
[Configure DNS Service](/docs/tasks/administer-cluster/dns-custom-nameservers/)
661
717
-->
662
718
有关管理 DNS 配置的指导,
663
- 请查看[ 配置 DNS 服务] ( /zh-cn/docs/tasks/administer-cluster/dns-custom-nameservers/ )
719
+ 请查看[ 配置 DNS 服务] ( /zh-cn/docs/tasks/administer-cluster/dns-custom-nameservers/ ) 。
0 commit comments