@@ -3,7 +3,6 @@ title: 使用服务来访问集群中的应用
3
3
content_type : tutorial
4
4
weight : 60
5
5
---
6
-
7
6
<!--
8
7
title: Use a Service to Access an Application in a Cluster
9
8
content_type: tutorial
@@ -32,7 +31,7 @@ provides load balancing for an application that has two running instances.
32
31
* Use the Service object to access the running application.
33
32
-->
34
33
* 运行 Hello World 应用的两个实例。
35
- * 创建一个服务对象来暴露 node port 。
34
+ * 创建一个服务对象来暴露 NodePort 。
36
35
* 使用服务对象来访问正在运行的应用。
37
36
38
37
<!-- lessoncontent -->
@@ -51,23 +50,23 @@ Here is the configuration file for the application Deployment:
51
50
<!--
52
51
1. Run a Hello World application in your cluster:
53
52
Create the application Deployment using the file above:
53
+ -->
54
+ 1 . 在你的集群中运行一个 Hello World 应用。
55
+ 使用上面的文件创建应用程序 Deployment:
56
+
54
57
``` shell
55
58
kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml
56
59
```
60
+
61
+ <!--
57
62
The preceding command creates a
58
63
{{< glossary_tooltip text="Deployment" term_id="deployment" >}}
59
64
and an associated
60
65
{{< glossary_tooltip term_id="replica-set" text="ReplicaSet" >}}.
61
66
The ReplicaSet has two
62
67
{{< glossary_tooltip text="Pods" term_id="pod" >}}
63
68
each of which runs the Hello World application.
64
- -->
65
- 1 . 在你的集群中运行一个 Hello World 应用:
66
- 使用上面的文件创建应用程序 Deployment:
67
-
68
- ``` shell
69
- kubectl apply -f https://k8s.io/examples/service/access/hello-application.yaml
70
- ```
69
+ -->
71
70
72
71
上面的命令创建一个
73
72
{{< glossary_tooltip text="Deployment" term_id="deployment" >}} 对象
@@ -118,7 +117,7 @@ Here is the configuration file for the application Deployment:
118
117
-->
119
118
输出类似于:
120
119
121
- ``` shell
120
+ ```
122
121
Name: example-service
123
122
Namespace: default
124
123
Labels: run=load-balancer-example
@@ -138,7 +137,7 @@ Here is the configuration file for the application Deployment:
138
137
Make a note of the NodePort value for the service. For example,
139
138
in the preceding output, the NodePort value is 31496.
140
139
-->
141
- 注意服务中的 NodePort 值。例如在上面的输出中,NodePort 是 31496。
140
+ 注意服务中的 NodePort 值。例如在上面的输出中,NodePort 值是 31496。
142
141
143
142
<!--
144
143
1. List the pods that are running the Hello World application:
@@ -152,9 +151,10 @@ Here is the configuration file for the application Deployment:
152
151
<!--
153
152
The output is similar to this:
154
153
-->
154
+
155
155
输出类似于:
156
156
157
- ``` shell
157
+ ```
158
158
NAME READY STATUS ... IP NODE
159
159
hello-world-2895499144-bsbk5 1/1 Running ... 10.200.1.4 worker1
160
160
hello-world-2895499144-m1pwt 1/1 Running ... 10.200.2.5 worker2
@@ -238,8 +238,9 @@ kubectl delete deployment hello-world
238
238
## {{% heading "whatsnext" %}}
239
239
240
240
<!--
241
- Learn more about
242
- [connecting applications with services](/docs/concepts/services-networking/connect-applications-service/).
241
+ Follow the
242
+ [Connecting Applications with Services](/docs/tutorials/services/connect-applications-service/)
243
+ tutorial.
243
244
-->
244
- 进一步了解 [ 通过服务连接应用 ] ( /zh-cn/docs/concepts /services-networking /connect-applications-service/ ) 。
245
+ 跟随教程 [ 使用 Service 连接到应用 ] ( /zh-cn/docs/tutorials /services/connect-applications-service/ ) 。
245
246
0 commit comments