1
1
---
2
- title : " 示例:使用 Redis 部署 PHP 留言板应用程序 "
2
+ title : " 示例:使用 Redis 部署 PHP 留言板应用 "
3
3
content_type : tutorial
4
4
weight : 20
5
5
card :
9
9
min-kubernetes-server-version : v1.14
10
10
source : https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook
11
11
---
12
-
13
12
<!--
14
13
title: "Example: Deploying PHP Guestbook application with Redis"
15
14
reviewers:
@@ -34,7 +33,7 @@ ready)_, multi-tier web application using Kubernetes and
34
33
components:
35
34
-->
36
35
本教程向你展示如何使用 Kubernetes 和 [ Docker] ( https://www.docker.com/ )
37
- 构建和部署一个简单的 ** (非面向生产的)** 多层 Web 应用程序 。本例由以下组件组成:
36
+ 构建和部署一个简单的 ** (非面向生产的)** 多层 Web 应用 。本例由以下组件组成:
38
37
39
38
<!--
40
39
* A single-instance [Redis](https://www.redis.io/) to store guestbook entries
@@ -73,7 +72,7 @@ components:
73
72
<!--
74
73
The guestbook application uses Redis to store its data.
75
74
-->
76
- 留言板应用程序使用 Redis 存储数据。
75
+ 留言板应用使用 Redis 存储数据。
77
76
78
77
<!--
79
78
### Creating the Redis Deployment
@@ -85,7 +84,7 @@ The manifest file, included below, specifies a Deployment controller that runs a
85
84
-->
86
85
下面包含的清单文件指定了一个 Deployment 控制器,该控制器运行一个 Redis Pod 副本。
87
86
88
- {{< code file="application/guestbook/redis-leader-deployment.yaml" > }}
87
+ {{% code_sample file="application/guestbook/redis-leader-deployment.yaml" % }}
89
88
90
89
<!--
91
90
1. Launch a terminal window in the directory you downloaded the manifest files.
@@ -142,16 +141,16 @@ You need to apply a [Service](/docs/concepts/services-networking/service/) to
142
141
proxy the traffic to the Redis Pod. A Service defines a policy to access the
143
142
Pods.
144
143
-->
145
- 留言板应用程序需要往 Redis 中写数据。因此,需要创建
144
+ 留言板应用需要往 Redis 中写数据。因此,需要创建
146
145
[ Service] ( /zh-cn/docs/concepts/services-networking/service/ ) 来转发 Redis Pod
147
146
的流量。Service 定义了访问 Pod 的策略。
148
147
149
- {{< code file="application/guestbook/redis-leader-service.yaml" > }}
148
+ {{% code_sample file="application/guestbook/redis-leader-service.yaml" % }}
150
149
151
150
<!--
152
151
1. Apply the Redis Service from the following `redis-leader-service.yaml` file:
153
152
-->
154
- 1 . 使用下面的 ` redis-leader-service.yaml ` 文件创建 Redis的服务 :
153
+ 1 . 使用下面的 ` redis-leader-service.yaml ` 文件创建 Redis 的服务 :
155
154
156
155
<!-- -
157
156
for local testing of the content via relative file path
@@ -188,8 +187,8 @@ This manifest file creates a Service named `redis-leader` with a set of labels
188
187
that match the labels previously defined, so the Service routes network
189
188
traffic to the Redis Pod.
190
189
-->
191
- 这个清单文件创建了一个名为 ` redis-leader ` 的 Service,其中包含一组
192
- 与前面定义的标签匹配的标签 ,因此服务将网络流量路由到 Redis Pod 上。
190
+ 这个清单文件创建了一个名为 ` redis-leader ` 的 Service,
191
+ 其中包含一组与前面定义的标签匹配的标签 ,因此服务将网络流量路由到 Redis Pod 上。
193
192
{{< /note >}}
194
193
195
194
<!--
@@ -203,7 +202,7 @@ and meet traffic demands by adding a few Redis followers, or replicas.
203
202
尽管 Redis 领导者只有一个 Pod,你可以通过添加若干 Redis 跟随者来将其配置为高可用状态,
204
203
以满足流量需求。
205
204
206
- {{< code file="application/guestbook/redis-follower-deployment.yaml" > }}
205
+ {{% code_sample file="application/guestbook/redis-follower-deployment.yaml" % }}
207
206
208
207
<!--
209
208
1. Apply the Redis Deployment from the following `redis-follower-deployment.yaml` file:
@@ -253,7 +252,7 @@ Guestbook 应用需要与 Redis 跟随者通信以读取数据。
253
252
为了让 Redis 跟随者可被发现,你必须创建另一个
254
253
[ Service] ( /zh-cn/docs/concepts/services-networking/service/ ) 。
255
254
256
- {{< code file="application/guestbook/redis-follower-service.yaml" > }}
255
+ {{% code_sample file="application/guestbook/redis-follower-service.yaml" % }}
257
256
258
257
<!--
259
258
1. Apply the Redis Service from the following `redis-follower-service.yaml` file:
@@ -301,7 +300,6 @@ traffic to the Redis Pod.
301
300
Redis Pod 之上。
302
301
{{< /note >}}
303
302
304
-
305
303
<!--
306
304
## Set up and Expose the Guestbook Frontend
307
305
-->
@@ -321,16 +319,16 @@ jQuery-Ajax-based UX.
321
319
接下来可以启动 Guestbook 的 Web 服务器了。
322
320
与 Redis 跟随者类似,前端也是使用 Kubernetes Deployment 来部署的。
323
321
324
- Guestbook 应用使用 PHP 前端。该前端被配置成与后端的 Redis 跟随者或者
325
- 领导者服务通信 ,具体选择哪个服务取决于请求是读操作还是写操作。
322
+ Guestbook 应用使用 PHP 前端。该前端被配置成与后端的 Redis
323
+ 跟随者或者领导者服务通信 ,具体选择哪个服务取决于请求是读操作还是写操作。
326
324
前端对外暴露一个 JSON 接口,并提供基于 jQuery-Ajax 的用户体验。
327
325
328
326
<!--
329
327
### Creating the Guestbook Frontend Deployment
330
328
-->
331
329
### 创建 Guestbook 前端 Deployment {#creating-the-guestbook-frontend-deployment}
332
330
333
- {{< code file="application/guestbook/frontend-deployment.yaml" > }}
331
+ {{% code_sample file="application/guestbook/frontend-deployment.yaml" % }}
334
332
335
333
<!--
336
334
1. Apply the frontend Deployment from the `frontend-deployment.yaml` file:
@@ -401,12 +399,12 @@ Some cloud providers, like Google Compute Engine or Google Kubernetes Engine,
401
399
support external load balancers. If your cloud provider supports load
402
400
balancers and you want to use it, uncomment `type: LoadBalancer`.
403
401
-->
404
- 一些云提供商,如 Google Compute Engine 或 Google Kubernetes Engine,
405
- 支持外部负载均衡器。如果你的云提供商支持负载均衡器 ,并且你希望使用它,
402
+ Google Compute Engine 或 Google Kubernetes Engine
403
+ 这些云平台支持外部负载均衡器。如果你的云平台支持负载均衡器 ,并且你希望使用它,
406
404
只需取消注释 ` type: LoadBalancer ` 。
407
405
{{< /note >}}
408
406
409
- {{< code file="application/guestbook/frontend-service.yaml" > }}
407
+ {{% code_sample file="application/guestbook/frontend-service.yaml" % }}
410
408
411
409
<!--
412
410
1. Apply the frontend Service from the `frontend-service.yaml` file:
@@ -655,10 +653,10 @@ labels to delete multiple resources with one command.
655
653
* Complete the [Kubernetes Basics](/docs/tutorials/kubernetes-basics/) Interactive Tutorials
656
654
* Use Kubernetes to create a blog using [Persistent Volumes for MySQL and Wordpress](/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/#visit-your-new-wordpress-blog)
657
655
* Read more about [connecting applications with services](/docs/tutorials/services/connect-applications-service/)
658
- * Read more about [Managing Resources ](/docs/concepts/cluster-administration/manage-deployment /#using-labels-effectively)
656
+ * Read more about [using labels effectively ](/docs/concepts/overview/working-with-objects/labels /#using-labels-effectively)
659
657
-->
660
658
* 完成 [ Kubernetes 基础] ( /zh-cn/docs/tutorials/kubernetes-basics/ ) 交互式教程
661
659
* 使用 Kubernetes 创建一个博客,使用
662
660
[ MySQL 和 Wordpress 的持久卷] ( /zh-cn/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/#visit-your-new-wordpress-blog )
663
661
* 进一步阅读[ 使用 Service 连接到应用] ( /zh-cn/docs/tutorials/services/connect-applications-service/ )
664
- * 进一步阅读[ 管理资源 ] ( /zh-cn/docs/concepts/cluster-administration/manage-deployment /#using-labels-effectively )
662
+ * 进一步阅读[ 有效使用标签 ] ( /zh-cn/docs/concepts/overview/working-with-objects/labels /#using-labels-effectively )
0 commit comments