Skip to content

Commit a5801e8

Browse files
committed
[zh-cn]sync dns-pod-service.md
Signed-off-by: xin.li <[email protected]>
1 parent 6780d1f commit a5801e8

File tree

1 file changed

+80
-24
lines changed

1 file changed

+80
-24
lines changed

content/zh-cn/docs/concepts/services-networking/dns-pod-service.md

Lines changed: 80 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ options ndots:5
9696
In summary, a Pod in the _test_ namespace can successfully resolve either
9797
`data.prod` or `data.prod.svc.cluster.local`.
9898
-->
99-
概括起来,命名空间 _test_ 中的 Pod 可以成功地解析 `data.prod` 或者
99+
概括起来,命名空间 **test** 中的 Pod 可以成功地解析 `data.prod` 或者
100100
`data.prod.svc.cluster.local`
101101

102102
<!--
@@ -112,8 +112,8 @@ What objects get DNS records?
112112

113113
哪些对象会获得 DNS 记录呢?
114114

115-
1. Services
116-
2. Pods
115+
1. Service
116+
2. Pod
117117

118118
<!--
119119
The following sections detail the supported DNS record types and layout that is
@@ -149,7 +149,7 @@ selection from the set.
149149

150150
#### A/AAAA 记录 {#a-aaaa-records}
151151

152-
除了无头 Service 之外的 “普通” Service 会被赋予一个形如 `my-svc.my-namespace.svc.cluster-domain.example`
152+
除了无头 Service 之外的“普通” Service 会被赋予一个形如 `my-svc.my-namespace.svc.cluster-domain.example`
153153
的 DNS A 和/或 AAAA 记录,取决于 Service 的 IP 协议族(可能有多个)设置。
154154
该名称会解析成对应 Service 的集群 IP。
155155

@@ -171,7 +171,6 @@ services.
171171
- For a headless Service, this resolves to multiple answers, one for each Pod
172172
that is backing the Service, and contains the port number and the domain name of the Pod
173173
of the form `hostname.my-svc.my-namespace.svc.cluster-domain.example`.
174-
175174
-->
176175
#### SRV 记录 {#srv-records}
177176

@@ -193,39 +192,49 @@ Kubernetes 根据普通 Service 或无头 Service 中的命名端口创建 SRV
193192
Kube-DNS versions, prior to the implementation of the
194193
[DNS specification](https://github.com/kubernetes/dns/blob/master/docs/specification.md),
195194
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 解析:
196200

197201
```
198-
pod-ipv4-address.my-namespace.pod.cluster-domain.example
202+
<pod-IPv4-address>.<namespace>.pod.<cluster-domain>
199203
```
200204

205+
<!--
201206
For example, if a Pod in the `default` namespace has the IP address 172.17.0.3,
202207
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 名称:
203211

204212
```
205213
172-17-0-3.default.pod.cluster.local
206214
```
207215

216+
<!--
208217
Some cluster DNS mechanisms, like [CoreDNS](https://coredns.io/), also provide `A` records for:
218+
-->
219+
一些集群 DNS 机制(如 [CoreDNS](https://coredns.io/))还会为以下内容提供 `A` 记录:
209220

210221
```
211222
<pod-ipv4-address>.<service-name>.<my-namespace>.svc.<cluster-domain.example>
212223
```
213-
-->
214-
### A/AAAA 记录 {#a-aaaa-records}
215-
216-
在实现 [DNS 规范](https://github.com/kubernetes/dns/blob/master/docs/specification.md)之前,
217-
Kube-DNS 版本使用以下 DNS 解析:
218224

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 记录:
227234

228-
`<pod-ipv4-address>.<service-name>.<my-namespace>.svc.<cluster-domain.example>.`
235+
```
236+
172-17-0-3.barista.cafe.svc.cluster.local
237+
```
229238

230239
<!--
231240
### Pod's hostname and subdomain fields
@@ -275,6 +284,53 @@ Example:
275284

276285
示例:
277286

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+
-->
278334
```yaml
279335
apiVersion: v1
280336
kind: Service
@@ -328,8 +384,8 @@ to `"busybox-subdomain"`, the first Pod will see its own FQDN as
328384
A and/or AAAA records at that name, pointing to the Pod's IP. Both Pods "`busybox1`" and
329385
"`busybox2`" will have their own address records.
330386
-->
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"`。
333389
DNS 会为此名字提供一个 A 记录和/或 AAAA 记录,指向该 Pod 的 IP。
334390
Pod “`busybox1`” 和 “`busybox2`” 都将有自己的地址记录。
335391

@@ -372,7 +428,7 @@ then by default the `hostname` command inside that Pod returns `busybox-1` and t
372428

373429
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.
374430
-->
375-
当 Pod 配置为具有全限定域名 (FQDN) 时,其主机名是短主机名。
431+
当 Pod 配置为具有全限定域名FQDN时,其主机名是短主机名。
376432
例如,如果你有一个具有完全限定域名 `busybox-1.busybox-subdomain.my-namespace.svc.cluster-domain.example` 的 Pod,
377433
则默认情况下,该 Pod 内的 `hostname` 命令返回 `busybox-1`,而 `hostname --fqdn` 命令返回 FQDN。
378434

@@ -660,4 +716,4 @@ For guidance on administering DNS configurations, check
660716
[Configure DNS Service](/docs/tasks/administer-cluster/dns-custom-nameservers/)
661717
-->
662718
有关管理 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

Comments
 (0)