Skip to content

Commit a973ab7

Browse files
authored
Merge pull request #22848 from tengqm/zh-links-concepts-2
[zh] Fix links in concepts section (2)
2 parents 7d66da9 + 9f7414e commit a973ab7

File tree

13 files changed

+535
-561
lines changed

13 files changed

+535
-561
lines changed

content/zh/docs/concepts/configuration/secret.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,17 @@ You can also create a Secret in a file first, in JSON or YAML format,
244244
and then create that object.
245245
The name of a Secret object must be a valid
246246
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
247-
248-
he
249-
[Secret](/docs/reference/generated/kubernetes-api/v1.12/#secret-v1-core) contains two maps:
250-
data and stringData. The data field is used to store arbitrary data, encoded using
247+
The [Secret](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#secret-v1-core)
248+
contains two maps:
249+
`data` and `stringData`. The `data` field is used to store arbitrary data, encoded using
251250
base64. The stringData field is provided for convenience, and allows you to provide
252251
secret data as unencoded strings.
253252
-->
254253
#### 手动创建 Secret
255254

256255
您也可以先以 JSON 或 YAML 格式文件创建一个 Secret,然后创建该对象。
257256
Secret 对象的名称必须是合法的 [DNS 子域名](/zh/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)
258-
[Secret](/docs/reference/generated/kubernetes-api/v1.12/#secret-v1-core)
257+
[Secret](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#secret-v1-core)
259258
包含两个映射:`data``stringData`
260259
`data` 字段用于存储使用 base64 编码的任意数据。
261260
提供 `stringData` 字段是为了方便,允许您用未编码的字符串提供机密数据。
@@ -1237,7 +1236,7 @@ See [Injecting Information into Pods Using a PodPreset](/docs/tasks/inject-data-
12371236

12381237
手动创建的 Secret(例如包含用于访问 GitHub 帐户令牌的 Secret)可以
12391238
根据其服务帐户自动附加到 Pod。
1240-
请参阅[使用 PodPreset 向 Pod 中注入信息](/zh/docs/tasks/run-application/podpreset/)
1239+
请参阅[使用 PodPreset 向 Pod 中注入信息](/zh/docs/tasks/inject-data-application/podpreset/)
12411240
以获取该过程的详细说明。
12421241

12431242
<!--
@@ -1872,7 +1871,7 @@ Secrets are protected when transmitted over these channels.
18721871
You can enable [encryption at rest](/docs/tasks/administer-cluster/encrypt-data/)
18731872
for secret data, so that the secrets are not stored in the clear into {{< glossary_tooltip term_id="etcd" >}}.
18741873
-->
1875-
你可以为 Secret 数据开启[静态加密](//zhdocs/tasks/administer-cluster/encrypt-data/),
1874+
你可以为 Secret 数据开启[静态加密](/zh/docs/tasks/administer-cluster/encrypt-data/),
18761875
这样 Secret 数据就不会以明文形式存储到{{< glossary_tooltip term_id="etcd" >}} 中。
18771876

18781877
<!--

content/zh/docs/concepts/scheduling-eviction/assign-pod-node.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ You can use `NotIn` and `DoesNotExist` to achieve node anti-affinity behavior, o
285285
[node taints](/docs/concepts/scheduling-eviction/taint-and-toleration/) to repel pods from specific nodes.
286286
-->
287287

288-
你可以在上面的例子中看到 `In` 操作符的使用。新的节点亲和语法支持下面的操作符: `In`,`NotIn`,`Exists`,`DoesNotExist`,`Gt`,`Lt`。你可以使用 `NotIn` 和 `DoesNotExist` 来实现节点反亲和行为,或者使用[节点污点](/zh/docs/concepts/scheduling-eviction/taint-and-toleration/)将 pod 从特定节点中驱逐。
288+
你可以在上面的例子中看到 `In` 操作符的使用。新的节点亲和语法支持下面的操作符:
289+
`In`,`NotIn`,`Exists`,`DoesNotExist`,`Gt`,`Lt`。
290+
你可以使用 `NotIn` 和 `DoesNotExist` 来实现节点反亲和行为,或者使用
291+
[节点污点](/zh/docs/concepts/scheduling-eviction/taint-and-toleration/)将 pod 从特定节点中驱逐。
289292

290293
<!--
291294
If you specify both `nodeSelector` and `nodeAffinity`, *both* must be satisfied for the pod
@@ -599,7 +602,10 @@ no two instances are located on the same host.
599602
See [ZooKeeper tutorial](/docs/tutorials/stateful-application/zookeeper/#tolerating-node-failure)
600603
for an example of a StatefulSet configured with anti-affinity for high availability, using the same technique.
601604
-->
602-
上面的例子使用 `PodAntiAffinity` 规则和 `topologyKey: "kubernetes.io/hostname"` 来部署 redis 集群以便在同一主机上没有两个实例。参阅 [ZooKeeper 教程](/zh/docs/tutorials/stateful-application/zookeeper/#tolerating-node-failure),以获取配置反亲和来达到高可用性的 StatefulSet 的样例(使用了相同的技巧)。
605+
上面的例子使用 `PodAntiAffinity` 规则和 `topologyKey: "kubernetes.io/hostname"`
606+
来部署 redis 集群以便在同一主机上没有两个实例。
607+
参阅 [ZooKeeper 教程](/zh/docs/tutorials/stateful-application/zookeeper/#tolerating-node-failure),
608+
以获取配置反亲和来达到高可用性的 StatefulSet 的样例(使用了相同的技巧)。
603609
604610
## nodeName
605611
@@ -660,24 +666,24 @@ The above pod will run on the node kube-01.
660666
[Taints](/docs/concepts/scheduling-eviction/taint-and-toleration/) allow a Node to *repel* a set of Pods.
661667
-->
662668

663-
[污点](/docs/concepts/scheduling-eviction/taint-and-toleration/)允许节点*排斥*一组 pod。
669+
[污点](/zh/docs/concepts/scheduling-eviction/taint-and-toleration/)允许节点*排斥*一组 pod。
664670

665671
<!--
666672
The design documents for
667673
[node affinity](https://git.k8s.io/community/contributors/design-proposals/scheduling/nodeaffinity.md)
668674
and for [inter-pod affinity/anti-affinity](https://git.k8s.io/community/contributors/design-proposals/scheduling/podaffinity.md) contain extra background information about these features.
669675
-->
670676

671-
[节点亲和](https://git.k8s.io/community/contributors/design-proposals/scheduling/nodeaffinity.md)[pod 间亲和/反亲和](https://git.k8s.io/community/contributors/design-proposals/scheduling/podaffinity.md)的设计文档包含这些功能的其他背景信息。
677+
[节点亲和](https://git.k8s.io/community/contributors/design-proposals/scheduling/nodeaffinity.md)
678+
[pod 间亲和/反亲和](https://git.k8s.io/community/contributors/design-proposals/scheduling/podaffinity.md)的设计文档包含这些功能的其他背景信息。
672679

673680
<!--
674681
Once a Pod is assigned to a Node, the kubelet runs the Pod and allocates node-local resources.
675682
The [topology manager](/docs/tasks/administer-cluster/topology-manager/) can take part in node-level
676683
resource allocation decisions.
677684
-->
678685

679-
一旦 pod 分配给 节点,kubelet 应用将运行该 pod 并且分配节点本地资源。
680-
[拓扑管理](/zh/docs/tasks/administer-cluster/topology-manager/)
686+
一旦 Pod 分配给 节点,kubelet 应用将运行该 pod 并且分配节点本地资源。
687+
[拓扑管理器](/zh/docs/tasks/administer-cluster/topology-manager/)
681688
可以参与到节点级别的资源分配决定中。
682689

683-

content/zh/docs/concepts/services-networking/connect-applications-service.md

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
title: 应用连接到 Service
2+
title: 使用 Service 连接到应用
33
content_type: concept
44
weight: 30
55
---
66

7-
87
<!-- overview -->
98

109
<!--
@@ -24,8 +23,6 @@ This guide uses a simple nginx server to demonstrate proof of concept. The same
2423
既然有了一个持续运行、可复制的应用,我们就能够将它暴露到网络上。
2524
在讨论 Kubernetes 网络连接的方式之前,非常值得与 Docker 中 “正常” 方式的网络进行对比。
2625

27-
28-
2926
默认情况下,Docker 使用私有主机网络连接,只能与同在一台机器上的容器进行通信。
3027
为了实现容器的跨节点通信,必须在机器自己的 IP 上为这些容器分配端口,为容器进行端口转发或者代理。
3128

@@ -35,10 +32,8 @@ Kubernetes 假设 Pod 可与其它 Pod 通信,不管它们在哪个主机上
3532
这表明了在 Pod 内的容器都能够连接到本地的每个端口,集群中的所有 Pod 不需要通过 NAT 转换就能够互相看到。
3633
文档的剩余部分将详述如何在一个网络模型之上运行可靠的服务。
3734

38-
该指南使用一个简单的 Nginx server 来演示并证明谈到的概念。同样的原则也体现在一个更加完整的 [Jenkins CI 应用](http://kubernetes.io/blog/2015/07/strong-simple-ssl-for-kubernetes.html) 中。
39-
40-
41-
35+
该指南使用一个简单的 Nginx server 来演示并证明谈到的概念。同样的原则也体现在一个更加完整的
36+
[Jenkins CI 应用](https://kubernetes.io/blog/2015/07/strong-simple-ssl-for-kubernetes.html) 中。
4237

4338
<!-- body -->
4439

@@ -48,7 +43,6 @@ Kubernetes 假设 Pod 可与其它 Pod 通信,不管它们在哪个主机上
4843
We did this in a previous example, but let's do it once again and focus on the networking perspective.
4944
Create an nginx Pod, and note that it has a container port specification:
5045
-->
51-
5246
## 在集群中暴露 Pod
5347

5448
我们在之前的示例中已经做过,然而再让我重试一次,这次聚焦在网络连接的视角。
@@ -75,7 +69,6 @@ my-nginx-3800858182-kna2y 1/1 Running 0 13s 10.244.2.5
7569
<!--
7670
Check your pods' IPs:
7771
-->
78-
7972
检查 Pod 的 IP 地址:
8073

8174
```shell
@@ -89,14 +82,12 @@ You should be able to ssh into any node in your cluster and curl both IPs. Note
8982
9083
You can read more about [how we achieve this](/docs/concepts/cluster-administration/networking/#how-to-achieve-this) if you're curious.
9184
-->
92-
9385
应该能够通过 ssh 登录到集群中的任何一个节点上,使用 curl 也能调通所有 IP 地址。
9486
需要注意的是,容器不会使用该节点上的 80 端口,也不会使用任何特定的 NAT 规则去路由流量到 Pod 上。
9587
这意味着可以在同一个节点上运行多个 Pod,使用相同的容器端口,并且可以从集群中任何其他的 Pod 或节点上使用 IP 的方式访问到它们。
9688
像 Docker 一样,端口能够被发布到主机节点的接口上,但是出于网络模型的原因应该从根本上减少这种用法。
9789

98-
如果对此好奇,可以获取更多关于 [如何实现网络模型](/docs/concepts/cluster-administration/networking/#how-to-achieve-this) 的内容。
99-
90+
如果对此好奇,可以获取更多关于 [如何实现网络模型](/zh/docs/concepts/cluster-administration/networking/#how-to-achieve-this) 的内容。
10091

10192
<!--
10293
## Creating a Service
@@ -107,7 +98,6 @@ A Kubernetes Service is an abstraction which defines a logical set of Pods runni
10798
10899
You can create a Service for your 2 nginx replicas with `kubectl expose`:
109100
-->
110-
111101
## 创建 Service
112102

113103
我们有 Pod 在一个扁平的、集群范围的地址空间中运行 Nginx 服务,可以直接连接到这些 Pod,但如果某个节点死掉了会发生什么呢?
@@ -145,9 +135,11 @@ View [Service](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/
145135
API object to see the list of supported fields in service definition.
146136
Check your Service:
147137
-->
148-
149-
上述规约将创建一个 Service,对应具有标签 `run: my-nginx` 的 Pod,目标 TCP 端口 80,并且在一个抽象的 Service 端口(`targetPort`:容器接收流量的端口;`port`:抽象的 Service 端口,可以使任何其它 Pod 访问该 Service 的端口)上暴露。
150-
查看 [Service API 对象](/docs/api-reference/{{< param "version" >}}/#service-v1-core) 了解 Service 定义支持的字段列表。
138+
上述规约将创建一个 Service,对应具有标签 `run: my-nginx` 的 Pod,目标 TCP 端口 80,
139+
并且在一个抽象的 Service 端口(`targetPort`:容器接收流量的端口;`port`:抽象的 Service
140+
端口,可以使任何其它 Pod 访问该 Service 的端口)上暴露。
141+
查看 [Service API 对象](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#service-v1-core)
142+
了解 Service 定义支持的字段列表。
151143
查看你的 Service 资源:
152144

153145
```shell
@@ -167,7 +159,6 @@ matching the Service's selector will automatically get added to the endpoints.
167159
Check the endpoints, and note that the IPs are the same as the Pods created in
168160
the first step:
169161
-->
170-
171162
正如前面所提到的,一个 Service 由一组 backend Pod 组成。这些 Pod 通过 `endpoints` 暴露出来。
172163
Service Selector 将持续评估,结果被 POST 到一个名称为 `my-nginx` 的 Endpoint 对象上。
173164
当 Pod 终止后,它会自动从 Endpoint 中移除,新的能够匹配上 Service Selector 的 Pod 将自动地被添加到 Endpoint 中。
@@ -206,7 +197,8 @@ about the [service proxy](/docs/concepts/services-networking/service/#virtual-ip
206197

207198
现在,能够从集群中任意节点上使用 curl 命令请求 Nginx Service `<CLUSTER-IP>:<PORT>`
208199
注意 Service IP 完全是虚拟的,它从来没有走过网络,如果对它如何工作的原理感到好奇,
209-
可以阅读更多关于 [服务代理](/docs/user-guide/services/#virtual-ips-and-service-proxies) 的内容。
200+
可以进一步阅读[服务代理](/zh/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies)
201+
的内容。
210202

211203
<!--
212204
## Accessing the Service
@@ -219,22 +211,19 @@ and DNS. The former works out of the box while the latter requires the
219211
## 访问 Service
220212

221213
Kubernetes支持两种查找服务的主要模式: 环境变量和DNS。 前者开箱即用,而后者则需要[CoreDNS集群插件]
222-
[CoreDNS 集群插件](http://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/coredns).
223-
224-
{{< note >}}
214+
[CoreDNS 集群插件](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/coredns).
225215

226216
<!--
227217
If the service environment variables are not desired (because possible clashing with expected program ones,
228218
too many variables to process, only using DNS, etc) you can disable this mode by setting the `enableServiceLinks`
229219
flag to `false` on the [pod spec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core).
230220
-->
231-
221+
{{< note >}}
232222
如果不需要服务环境变量(因为可能与预期的程序冲突,可能要处理的变量太多,或者仅使用DNS等),则可以通过在
233-
[pod spec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core)上将 `enableServiceLinks` 标志设置为 `false` 来禁用此模式。
234-
223+
[pod spec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core)
224+
上将 `enableServiceLinks` 标志设置为 `false` 来禁用此模式。
235225
{{< /note >}}
236226

237-
238227
<!--
239228
### Environment Variables
240229
@@ -324,9 +313,10 @@ The rest of this section will assume you have a Service with a long lived IP
324313
cluster addon), so you can talk to the Service from any pod in your cluster using
325314
standard methods (e.g. gethostbyname). Let's run another curl application to test this:
326315
-->
327-
328-
如果没有在运行,可以 [启用它](http://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/kube-dns/README.md#how-do-i-configure-it)。
329-
本段剩余的内容,将假设已经有一个 Service,它具有一个长久存在的 IP(my-nginx),一个为该 IP 指派名称的 DNS 服务器(kube-dns 集群插件),所以可以通过标准做法,使在集群中的任何 Pod 都能与该 Service 通信(例如:gethostbyname)。
316+
如果没有在运行,可以[启用它](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/kube-dns/README.md#how-do-i-configure-it)。
317+
本段剩余的内容,将假设已经有一个 Service,它具有一个长久存在的 IP(my-nginx),
318+
一个为该 IP 指派名称的 DNS 服务器(kube-dns 集群插件),所以可以通过标准做法,
319+
使在集群中的任何 Pod 都能与该 Service 通信(例如:gethostbyname)。
330320
让我们运行另一个 curl 应用来进行测试:
331321

332322
```shell
@@ -370,9 +360,10 @@ You can acquire all these from the [nginx https example](https://github.com/kube
370360

371361
* https 自签名证书(除非已经有了一个识别身份的证书)
372362
* 使用证书配置的 Nginx server
373-
* 使证书可以访问 Pod 的[秘钥](/docs/user-guide/secrets)
363+
* 使证书可以访问 Pod 的 [Secret](/zh/docs/concepts/configuration/secret/)
374364

375-
可以从 [Nginx https 示例](https://github.com/kubernetes/kubernetes/tree/{{< param "githubbranch" >}}/examples/https-nginx/) 获取所有上述内容,简明示例如下:
365+
可以从 [Nginx https 示例](https://github.com/kubernetes/kubernetes/tree/{{< param "githubbranch" >}}/examples/https-nginx/)
366+
获取所有上述内容,简明示例如下:
376367

377368
```shell
378369
make keys KEY=/tmp/nginx.key CERT=/tmp/nginx.crt
@@ -456,7 +447,8 @@ Noteworthy points about the nginx-secure-app manifest:
456447
关于 nginx-secure-app manifest 值得注意的点如下:
457448

458449
- 它在相同的文件中包含了 Deployment 和 Service 的规格
459-
- [Nginx server](https://github.com/kubernetes/kubernetes/tree/{{< param "githubbranch" >}}/examples/https-nginx/default.conf) 处理 80 端口上的 http 流量,以及 443 端口上的 https 流量,Nginx Service 暴露了这两个端口。
450+
- [Nginx 服务器](https://github.com/kubernetes/kubernetes/tree/{{< param "githubbranch" >}}/examples/https-nginx/default.conf)
451+
处理 80 端口上的 http 流量,以及 443 端口上的 https 流量,Nginx Service 暴露了这两个端口。
460452
- 每个容器访问挂载在 /etc/nginx/ssl 卷上的秘钥。这需要在 Nginx server 启动之前安装好。
461453

462454
```shell
@@ -483,7 +475,8 @@ so we have to tell curl to ignore the CName mismatch. By creating a Service we l
483475
Let's test this from a pod (the same secret is being reused for simplicity, the pod only needs nginx.crt to access the Service):
484476
-->
485477

486-
注意最后一步我们是如何提供 `-k` 参数执行 curl命令的,这是因为在证书生成时,我们不知道任何关于运行 Nginx 的 Pod 的信息,所以不得不在执行 curl 命令时忽略 CName 不匹配的情况。
478+
注意最后一步我们是如何提供 `-k` 参数执行 curl命令的,这是因为在证书生成时,
479+
我们不知道任何关于运行 Nginx 的 Pod 的信息,所以不得不在执行 curl 命令时忽略 CName 不匹配的情况。
487480
通过创建 Service,我们连接了在证书中的 CName 与在 Service 查询时被 Pod使用的实际 DNS 名字。
488481
让我们从一个 Pod 来测试(为了简化使用同一个秘钥,Pod 仅需要使用 nginx.crt 去访问 Service):
489482

@@ -513,15 +506,18 @@ LoadBalancers. The Service created in the last section already used `NodePort`,
513506
so your nginx HTTPS replica is ready to serve traffic on the internet if your
514507
node has a public IP.
515508
-->
516-
517509
## 暴露 Service
518510

519511
对我们应用的某些部分,可能希望将 Service 暴露在一个外部 IP 地址上。
520512
Kubernetes 支持两种实现方式:NodePort 和 LoadBalancer。
521-
在上一段创建的 Service 使用了 `NodePort`,因此 Nginx https 副本已经就绪,如果使用一个公网 IP,能够处理 Internet 上的流量。
513+
在上一段创建的 Service 使用了 `NodePort`,因此 Nginx https 副本已经就绪,
514+
如果使用一个公网 IP,能够处理 Internet 上的流量。
522515

523516
```shell
524517
kubectl get svc my-nginx -o yaml | grep nodePort -C 5
518+
```
519+
520+
```
525521
uid: 07191fb3-f61a-11e5-8ae5-42010af00002
526522
spec:
527523
clusterIP: 10.0.162.149
@@ -539,8 +535,12 @@ spec:
539535
selector:
540536
run: my-nginx
541537
```
538+
542539
```shell
543540
kubectl get nodes -o yaml | grep ExternalIP -C 1
541+
```
542+
543+
```
544544
- address: 104.197.41.11
545545
type: ExternalIP
546546
allocatable:
@@ -549,8 +549,14 @@ kubectl get nodes -o yaml | grep ExternalIP -C 1
549549
type: ExternalIP
550550
allocatable:
551551
...
552+
```
552553

553-
$ curl https://<EXTERNAL-IP>:<NODE-PORT> -k
554+
```shell
555+
curl https://<EXTERNAL-IP>:<NODE-PORT> -k
556+
```
557+
558+
输出类似于:
559+
```
554560
...
555561
<h1>Welcome to nginx!</h1>
556562
```
@@ -593,13 +599,14 @@ see it. You'll see something like this:
593599

594600
```shell
595601
kubectl describe service my-nginx
602+
```
603+
604+
```
596605
...
597606
LoadBalancer Ingress: a320587ffd19711e5a37606cf4a74574-1142138393.us-east-1.elb.amazonaws.com
598607
...
599608
```
600609

601-
602-
603610
## {{% heading "whatsnext" %}}
604611

605612
<!--
@@ -610,3 +617,4 @@ LoadBalancer Ingress: a320587ffd19711e5a37606cf4a74574-1142138393.us-east-1.el
610617
* 进一步了解如何[使用 Service 访问集群中的应用](/zh/docs/tasks/access-application-cluster/service-access-application-cluster/)
611618
* 进一步了解如何[使用 Service 将前端连接到后端](/zh/docs/tasks/access-application-cluster/connecting-frontend-backend/)
612619
* 进一步了解如何[创建外部负载均衡器](/zh/docs/tasks/access-application-cluster/create-external-load-balancer/)
620+

0 commit comments

Comments
 (0)