@@ -22,7 +22,7 @@ provides load balancing for an application that has two running instances.
22
22
23
23
## {{% heading "prerequisites" %}}
24
24
25
- {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
25
+ {{< include "task-tutorial-prereqs.md" >}}
26
26
27
27
## {{% heading "objectives" %}}
28
28
@@ -42,7 +42,7 @@ provides load balancing for an application that has two running instances.
42
42
43
43
Here is the configuration file for the application Deployment:
44
44
-->
45
- ## 为运行在两个 pod 中的应用创建一个服务
45
+ ## 为运行在两个 Pod 中的应用创建一个服务 {#creating-a-service-for-an-app-running-in-two-pods}
46
46
47
47
这是应用程序部署的配置文件:
48
48
@@ -55,24 +55,24 @@ Here is the configuration file for the application Deployment:
55
55
kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml
56
56
```
57
57
The preceding command creates a
58
- [ Deployment](/docs/concepts/workloads/controllers/ deployment/)
59
- object and an associated
60
- [ ReplicaSet](/docs/concepts/workloads/controllers/replicaset/)
61
- object. The ReplicaSet has two
62
- [ Pods](/docs/concepts/workloads/pods/ pod/),
58
+ {{< glossary_tooltip text=" Deployment" term_id=" deployment" >}}
59
+ and an associated
60
+ {{< glossary_tooltip term_id="replica-set" text=" ReplicaSet" >}}.
61
+ The ReplicaSet has two
62
+ {{< glossary_tooltip text=" Pods" term_id=" pod" >}}
63
63
each of which runs the Hello World application.
64
64
-->
65
-
66
65
1 . 在你的集群中运行一个 Hello World 应用:
67
66
使用上面的文件创建应用程序 Deployment:
68
67
69
68
``` shell
70
69
kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml
71
70
```
72
71
73
- 上面的命令创建一个 [ Deployment] ( /zh-cn/docs/concepts/workloads/controllers/deployment/ ) 对象
74
- 和一个关联的 [ ReplicaSet] ( /zh-cn/docs/concepts/workloads/controllers/replicaset/ ) 对象。
75
- 这个 ReplicaSet 有两个 [ Pod] ( /zh-cn/docs/concepts/workloads/pods/ ) ,
72
+ 上面的命令创建一个
73
+ {{< glossary_tooltip text="Deployment" term_id="deployment" >}} 对象
74
+ 和一个关联的 {{< glossary_tooltip term_id="replica-set" text="ReplicaSet" >}} 对象。
75
+ 这个 ReplicaSet 有两个 {{< glossary_tooltip text="Pod" term_id="pod" >}},
76
76
每个 Pod 都运行着 Hello World 应用。
77
77
78
78
<!--
@@ -143,7 +143,7 @@ Here is the configuration file for the application Deployment:
143
143
<!--
144
144
1. List the pods that are running the Hello World application:
145
145
-->
146
- 7 . 列出运行 Hello World 应用的 Pod:
146
+ 6 . 列出运行 Hello World 应用的 Pod:
147
147
148
148
``` shell
149
149
kubectl get pods --selector=" run=load-balancer-example" --output=wide
@@ -175,15 +175,16 @@ Here is the configuration file for the application Deployment:
175
175
176
176
1. Use the node address and node port to access the Hello World application:
177
177
-->
178
- 8 . 获取运行 Hello World 的 pod 的其中一个节点的公共 IP 地址。如何获得此地址取决于你设置集群的方式。
178
+ 7 . 获取运行 Hello World 的 pod 的其中一个节点的公共 IP 地址。如何获得此地址取决于你设置集群的方式。
179
179
例如,如果你使用的是 Minikube,则可以通过运行 ` kubectl cluster-info ` 来查看节点地址。
180
- 如果你使用的是 Google Compute Engine 实例,则可以使用 ` gcloud compute instances list ` 命令查看节点的公共地址。
180
+ 如果你使用的是 Google Compute Engine 实例,
181
+ 则可以使用 ` gcloud compute instances list ` 命令查看节点的公共地址。
181
182
182
- 9 . 在你选择的节点上,创建一个防火墙规则以开放节点端口上的 TCP 流量。
183
+ 8 . 在你选择的节点上,创建一个防火墙规则以开放节点端口上的 TCP 流量。
183
184
例如,如果你的服务的 NodePort 值为 31568,请创建一个防火墙规则以允许 31568 端口上的 TCP 流量。
184
185
不同的云提供商提供了不同方法来配置防火墙规则。
185
186
186
- 10 . 使用节点地址和 node port 来访问 Hello World 应用:
187
+ 9 . 使用节点地址和 node port 来访问 Hello World 应用:
187
188
188
189
``` shell
189
190
curl http://< public-node-ip> :< node-port>
@@ -208,10 +209,10 @@ As an alternative to using `kubectl expose`, you can use a
208
209
[service configuration file](/docs/concepts/services-networking/service/)
209
210
to create a Service.
210
211
-->
211
- ## 使用服务配置文件
212
+ ## 使用服务配置文件 {#using-a-service-configuration-file}
212
213
213
- 作为 ` kubectl expose ` 的替代方法,你可以使用
214
- [ 服务配置文件] ( /zh-cn/docs/concepts/services-networking/service/ ) 来创建服务。
214
+ 作为 ` kubectl expose ` 的替代方法,
215
+ 你可以使用 [ 服务配置文件] ( /zh-cn/docs/concepts/services-networking/service/ ) 来创建服务。
215
216
216
217
## {{% heading "cleanup" %}}
217
218
@@ -240,5 +241,5 @@ kubectl delete deployment hello-world
240
241
Learn more about
241
242
[connecting applications with services](/docs/concepts/services-networking/connect-applications-service/).
242
243
-->
243
- - 进一步了解[ 通过服务连接应用] ( /zh-cn/docs/concepts/services-networking/connect-applications-service/ ) 。
244
+ 进一步了解[ 通过服务连接应用] ( /zh-cn/docs/concepts/services-networking/connect-applications-service/ ) 。
244
245
0 commit comments