[zh] Remove Master/Slave terminology from stateless application tutorial
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
---
|
||||
title: "示例:使用 Redis 部署 PHP 留言板应用程序"
|
||||
title: "示例:使用 MongoDB 部署 PHP 留言板应用程序"
|
||||
content_type: tutorial
|
||||
weight: 20
|
||||
card:
|
||||
name: tutorials
|
||||
weight: 30
|
||||
title: "无状态应用示例:基于 Redis 的 PHP Guestbook"
|
||||
title: "无状态应用示例:基于 MongoDB 的 PHP Guestbook"
|
||||
min-kubernetes-server-version: v1.14
|
||||
---
|
||||
|
||||
<!--
|
||||
title: "Example: Deploying PHP Guestbook application with Redis"
|
||||
title: "Example: Deploying PHP Guestbook application with MongoDB"
|
||||
reviewers:
|
||||
- ahmetb
|
||||
content_type: tutorial
|
||||
@@ -17,25 +18,24 @@ weight: 20
|
||||
card:
|
||||
name: tutorials
|
||||
weight: 30
|
||||
title: "Stateless Example: PHP Guestbook with Redis"
|
||||
title: "Stateless Example: PHP Guestbook with MongoDB"
|
||||
min-kubernetes-server-version: v1.14
|
||||
-->
|
||||
|
||||
<!-- overview -->
|
||||
|
||||
<!--
|
||||
This tutorial shows you how to build and deploy a simple, multi-tier web application using Kubernetes and [Docker](https://www.docker.com/). This example consists of the following components:
|
||||
This tutorial shows you how to build and deploy a simple _(not production ready)_, multi-tier web application using Kubernetes and [Docker](https://www.docker.com/). This example consists of the following components:
|
||||
-->
|
||||
本教程向您展示如何使用 Kubernetes 和 [Docker](https://www.docker.com/) 构建和部署
|
||||
一个简单的多层 web 应用程序。本例由以下组件组成:
|
||||
一个简单的_(非面向生产)的_多层 web 应用程序。本例由以下组件组成:
|
||||
|
||||
<!--
|
||||
* A single-instance [Redis](https://redis.io/) master to store guestbook entries
|
||||
* Multiple [replicated Redis](https://redis.io/topics/replication) instances to serve reads
|
||||
* A single-instance [MongoDB](https://www.mongodb.com/) to store guestbook entries
|
||||
* Multiple web frontend instances
|
||||
-->
|
||||
|
||||
* 单实例 [Redis](https://redis.io/) 主节点保存留言板条目
|
||||
* 多个[从 Redis](https://redis.io/topics/replication) 节点用来读取数据
|
||||
* 单实例 [MongoDB](https://www.mongodb.com/) 以保存留言板条目
|
||||
* 多个 web 前端实例
|
||||
|
||||
|
||||
@@ -45,15 +45,13 @@ This tutorial shows you how to build and deploy a simple, multi-tier web applica
|
||||
|
||||
|
||||
<!--
|
||||
* Start up a Redis master.
|
||||
* Start up Redis slaves.
|
||||
* Start up a Mongo database.
|
||||
* Start up the guestbook frontend.
|
||||
* Expose and view the Frontend Service.
|
||||
* Clean up.
|
||||
-->
|
||||
|
||||
* 启动 Redis 主节点。
|
||||
* 启动 Redis 从节点。
|
||||
* 启动 Mongo 数据库。
|
||||
* 启动留言板前端。
|
||||
* 公开并查看前端服务。
|
||||
* 清理。
|
||||
@@ -72,44 +70,50 @@ This tutorial shows you how to build and deploy a simple, multi-tier web applica
|
||||
<!-- lessoncontent -->
|
||||
|
||||
<!--
|
||||
## Start up the Redis Master
|
||||
## Start up the Mongo Database
|
||||
-->
|
||||
|
||||
## 启动 Redis 主节点
|
||||
## 启动 Mongo 数据库
|
||||
|
||||
<!--
|
||||
The guestbook application uses Redis to store its data. It writes its data to a Redis master instance and reads data from multiple Redis slave instances.
|
||||
The guestbook application uses MongoDB to store its data.
|
||||
-->
|
||||
留言板应用程序使用 Redis 存储数据。它将数据写入一个 Redis 主实例,并从多个 Redis 读取数据。
|
||||
留言板应用程序使用 MongoDB 存储数据。
|
||||
|
||||
<!--
|
||||
### Creating the Redis Master Deployment
|
||||
### Creating the Mongo Deployment
|
||||
-->
|
||||
|
||||
### 创建 Redis 主节点的 Deployment
|
||||
### 创建 Mongo 的 Deployment
|
||||
|
||||
<!--
|
||||
The manifest file, included below, specifies a Deployment controller that runs a single replica Redis master Pod.
|
||||
The manifest file, included below, specifies a Deployment controller that runs a single replica MongoDB Pod.
|
||||
-->
|
||||
下面包含的清单文件指定了一个 Deployment 控制器,该控制器运行一个 Redis 主节点 Pod 副本。
|
||||
下面包含的清单文件指定了一个 Deployment 控制器,该控制器运行一个 MongoDB Pod 副本。
|
||||
|
||||
{{< codenew file="application/guestbook/redis-master-deployment.yaml" >}}
|
||||
{{< codenew file="application/guestbook/mongo-deployment.yaml" >}}
|
||||
|
||||
<!--
|
||||
1. Launch a terminal window in the directory you downloaded the manifest files.
|
||||
1. Apply the Redis Master Deployment from the `redis-master-deployment.yaml` file:
|
||||
1. Apply the MongoDB Deployment from the `mongo-deployment.yaml` file:
|
||||
-->
|
||||
1. 在下载清单文件的目录中启动终端窗口。
|
||||
2. 从 `redis-master-deployment.yaml` 文件中应用 Redis 主 Deployment:
|
||||
2. 从 `mongo-deployment.yaml` 文件中应用 MongoDB Deployment:
|
||||
|
||||
```shell
|
||||
kubectl apply -f https://k8s.io/examples/application/guestbook/redis-master-deployment.yaml
|
||||
kubectl apply -f https://k8s.io/examples/application/guestbook/mongo-deployment.yaml
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Query the list of Pods to verify that the Redis Master Pod is running:
|
||||
<!---
|
||||
for local testing of the content via relative file path
|
||||
kubectl apply -f ./content/en/examples/application/guestbook/mongo-deployment.yaml
|
||||
-->
|
||||
3. 查询 Pod 列表以验证 Redis 主节点 Pod 是否正在运行:
|
||||
|
||||
|
||||
<!--
|
||||
1. Query the list of Pods to verify that the MongoDB Pod is running:
|
||||
-->
|
||||
3. 查询 Pod 列表以验证 MongoDB Pod 是否正在运行:
|
||||
|
||||
```shell
|
||||
kubectl get pods
|
||||
@@ -122,53 +126,49 @@ The manifest file, included below, specifies a Deployment controller that runs a
|
||||
|
||||
```shell
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
redis-master-1068406935-3lswp 1/1 Running 0 28s
|
||||
mongo-5cfd459dd4-lrcjb 1/1 Running 0 28s
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Run the following command to view the logs from the Redis Master Pod:
|
||||
1. Run the following command to view the logs from the MongoDB Deployment:
|
||||
-->
|
||||
4. 运行以下命令查看 Redis 主节点 Pod 中的日志:
|
||||
4. 运行以下命令查看 MongoDB Deployment 中的日志:
|
||||
|
||||
```shell
|
||||
kubectl logs -f POD-NAME
|
||||
kubectl logs -f deployment/mongo
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
|
||||
<!--
|
||||
Replace POD-NAME with the name of your Pod.
|
||||
-->
|
||||
将 POD-NAME 替换为您的 Pod 名称。
|
||||
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
### Creating the Redis Master Service
|
||||
### Creating the MongoDB Service
|
||||
-->
|
||||
|
||||
### 创建 Redis 主节点的服务
|
||||
### 创建 MongoDB 服务
|
||||
|
||||
<!--
|
||||
The guestbook application needs to communicate to the Redis master to write its data. You need to apply a [Service](/docs/concepts/services-networking/service/) to proxy the traffic to the Redis master Pod. A Service defines a policy to access the Pods.
|
||||
The guestbook application needs to communicate to the MongoDB to write its data. You need to apply a [Service](/docs/concepts/services-networking/service/) to proxy the traffic to the MongoDB Pod. A Service defines a policy to access the Pods.
|
||||
-->
|
||||
留言板应用程序需要往 Redis 主节点中写数据。因此,需要创建 [Service](/zh/docs/concepts/services-networking/service/) 来代理 Redis 主节点 Pod 的流量。Service 定义了访问 Pod 的策略。
|
||||
留言板应用程序需要往 MongoDB 中写数据。因此,需要创建 [Service](/zh/docs/concepts/services-networking/service/) 来代理 MongoDB Pod 的流量。Service 定义了访问 Pod 的策略。
|
||||
|
||||
{{< codenew file="application/guestbook/redis-master-service.yaml" >}}
|
||||
{{< codenew file="application/guestbook/mongo-service.yaml" >}}
|
||||
|
||||
<!--
|
||||
1. Apply the Redis Master Service from the following `redis-master-service.yaml` file:
|
||||
1. Apply the MongoDB Service from the following `mongo-service.yaml` file:
|
||||
-->
|
||||
1. 使用下面的 `redis-master-service.yaml` 文件创建 Redis 主节点的服务:
|
||||
1. 使用下面的 `mongo-service.yaml` 文件创建 MongoDB 的服务:
|
||||
|
||||
```shell
|
||||
kubectl apply -f https://k8s.io/examples/application/guestbook/redis-master-service.yaml
|
||||
kubectl apply -f https://k8s.io/examples/application/guestbook/mongo-service.yaml
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Query the list of Services to verify that the Redis Master Service is running:
|
||||
<!---
|
||||
for local testing of the content via relative file path
|
||||
kubectl apply -f ./content/en/examples/application/guestbook/mongo-service.yaml
|
||||
-->
|
||||
2. 查询服务列表验证 Redis 主节点服务是否正在运行:
|
||||
|
||||
<!--
|
||||
1. Query the list of Services to verify that the MongoDB Service is running:
|
||||
-->
|
||||
2. 查询服务列表验证 MongoDB 服务是否正在运行:
|
||||
|
||||
```shell
|
||||
kubectl get service
|
||||
@@ -182,134 +182,26 @@ The guestbook application needs to communicate to the Redis master to write its
|
||||
```shell
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 1m
|
||||
redis-master ClusterIP 10.0.0.151 <none> 6379/TCP 8s
|
||||
mongo ClusterIP 10.0.0.151 <none> 6379/TCP 8s
|
||||
```
|
||||
|
||||
<!--
|
||||
This manifest file creates a Service named `mongo` with a set of labels that match the labels previously defined, so the Service routes network traffic to the MongoDB Pod.
|
||||
-->
|
||||
{{< note >}}
|
||||
|
||||
<!--
|
||||
This manifest file creates a Service named `redis-master` with a set of labels that match the labels previously defined, so the Service routes network traffic to the Redis master Pod.
|
||||
-->
|
||||
这个清单文件创建了一个名为 `Redis-master` 的 Service,其中包含一组与前面定义的标签匹配的标签,因此服务将网络流量路由到 Redis 主节点 Pod 上。
|
||||
|
||||
这个清单文件创建了一个名为 `mongo` 的 Service,其中包含一组与前面定义的标签匹配的标签,因此服务将网络流量路由到 MongoDB Pod 上。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
## Start up the Redis Slaves
|
||||
-->
|
||||
|
||||
## 启动 Redis 从节点
|
||||
|
||||
<!--
|
||||
Although the Redis master is a single pod, you can make it highly available to meet traffic demands by adding replica Redis slaves.
|
||||
-->
|
||||
尽管 Redis 主节点是一个单独的 pod,但是您可以通过添加 Redis 从节点的方式来使其高可用性,以满足流量需求。
|
||||
|
||||
<!--
|
||||
### Creating the Redis Slave Deployment
|
||||
-->
|
||||
|
||||
### 创建 Redis 从节点 Deployment
|
||||
|
||||
<!--
|
||||
Deployments scale based off of the configurations set in the manifest file. In this case, the Deployment object specifies two replicas.
|
||||
-->
|
||||
Deployments 根据清单文件中设置的配置进行伸缩。在这种情况下,Deployment 对象指定两个副本。
|
||||
|
||||
<!--
|
||||
If there are not any replicas running, this Deployment would start the two replicas on your container cluster. Conversely, if there are more than two replicas are running, it would scale down until two replicas are running.
|
||||
-->
|
||||
如果没有任何副本正在运行,则此 Deployment 将启动容器集群上的两个副本。相反,
|
||||
如果有两个以上的副本在运行,那么它的规模就会缩小,直到运行两个副本为止。
|
||||
|
||||
{{< codenew file="application/guestbook/redis-slave-deployment.yaml" >}}
|
||||
|
||||
<!--
|
||||
1. Apply the Redis Slave Deployment from the `redis-slave-deployment.yaml` file:
|
||||
-->
|
||||
1. 从 `redis-slave-deployment.yaml` 文件中应用 Redis Slave Deployment:
|
||||
|
||||
```shell
|
||||
kubectl apply -f https://k8s.io/examples/application/guestbook/redis-slave-deployment.yaml
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Query the list of Pods to verify that the Redis Slave Pods are running:
|
||||
-->
|
||||
2. 查询 Pod 列表以验证 Redis Slave Pod 正在运行:
|
||||
|
||||
```shell
|
||||
kubectl get pods
|
||||
```
|
||||
|
||||
<!--
|
||||
The response should be similar to this:
|
||||
-->
|
||||
响应应该与此类似:
|
||||
|
||||
```shell
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
redis-master-1068406935-3lswp 1/1 Running 0 1m
|
||||
redis-slave-2005841000-fpvqc 0/1 ContainerCreating 0 6s
|
||||
redis-slave-2005841000-phfv9 0/1 ContainerCreating 0 6s
|
||||
```
|
||||
|
||||
<!--
|
||||
### Creating the Redis Slave Service
|
||||
-->
|
||||
|
||||
### 创建 Redis 从节点的 Service
|
||||
|
||||
<!--
|
||||
The guestbook application needs to communicate to Redis slaves to read data. To make the Redis slaves discoverable, you need to set up a Service. A Service provides transparent load balancing to a set of Pods.
|
||||
-->
|
||||
留言板应用程序需要从 Redis 从节点中读取数据。
|
||||
为了便于 Redis 从节点可发现,
|
||||
您需要设置一个 Service。Service 为一组 Pod 提供负载均衡。
|
||||
|
||||
{{< codenew file="application/guestbook/redis-slave-service.yaml" >}}
|
||||
|
||||
<!--
|
||||
1. Apply the Redis Slave Service from the following `redis-slave-service.yaml` file:
|
||||
-->
|
||||
1. 从以下 `redis-slave-service.yaml` 文件应用 Redis Slave 服务:
|
||||
|
||||
```shell
|
||||
kubectl apply -f https://k8s.io/examples/application/guestbook/redis-slave-service.yaml
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Query the list of Services to verify that the Redis slave service is running:
|
||||
-->
|
||||
2. 查询服务列表以验证 Redis 在服务是否正在运行:
|
||||
|
||||
```shell
|
||||
kubectl get services
|
||||
```
|
||||
|
||||
<!--
|
||||
The response should be similar to this:
|
||||
-->
|
||||
响应应该与此类似:
|
||||
|
||||
```
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 2m
|
||||
redis-master ClusterIP 10.0.0.151 <none> 6379/TCP 1m
|
||||
redis-slave ClusterIP 10.0.0.223 <none> 6379/TCP 6s
|
||||
```
|
||||
|
||||
<!--
|
||||
## Set up and Expose the Guestbook Frontend
|
||||
-->
|
||||
|
||||
## 设置并公开留言板前端
|
||||
|
||||
<!--
|
||||
The guestbook application has a web frontend serving the HTTP requests written in PHP. It is configured to connect to the `redis-master` Service for write requests and the `redis-slave` service for Read requests.
|
||||
-->
|
||||
<!--
|
||||
The guestbook application has a web frontend serving the HTTP requests written in PHP. It is configured to connect to the `mongo` Service to store Guestbook entries.
|
||||
-->
|
||||
留言板应用程序有一个 web 前端,服务于用 PHP 编写的 HTTP 请求。
|
||||
它被配置为连接到写请求的 `redis-master` 服务和读请求的 `redis-slave` 服务。
|
||||
它被配置为连接到 `mongo` 服务以存储留言版条目。
|
||||
|
||||
<!--
|
||||
### Creating the Guestbook Frontend Deployment
|
||||
@@ -328,13 +220,18 @@ The guestbook application has a web frontend serving the HTTP requests written i
|
||||
kubectl apply -f https://k8s.io/examples/application/guestbook/frontend-deployment.yaml
|
||||
```
|
||||
|
||||
<!---
|
||||
for local testing of the content via relative file path
|
||||
kubectl apply -f ./content/en/examples/application/guestbook/frontend-deployment.yaml
|
||||
-->
|
||||
|
||||
<!--
|
||||
1. Query the list of Pods to verify that the three frontend replicas are running:
|
||||
-->
|
||||
2. 查询 Pod 列表,验证三个前端副本是否正在运行:
|
||||
|
||||
```shell
|
||||
kubectl get pods -l app=guestbook -l tier=frontend
|
||||
kubectl get pods -l app.kubernetes.io/name=guestbook -l app.kubernetes.io/component=frontend
|
||||
```
|
||||
|
||||
<!--
|
||||
@@ -356,24 +253,22 @@ The guestbook application has a web frontend serving the HTTP requests written i
|
||||
### 创建前端服务
|
||||
|
||||
<!--
|
||||
The `redis-slave` and `redis-master` Services you applied are only accessible within the container cluster because the default type for a Service is [ClusterIP](/docs/concepts/services-networking/service/#publishing-services---service-types). `ClusterIP` provides a single IP address for the set of Pods the Service is pointing to. This IP address is accessible only within the cluster.
|
||||
The `mongo` Services you applied is only accessible within the Kubernetes cluster because the default type for a Service is [ClusterIP](/docs/concepts/services-networking/service/#publishing-services---service-types). `ClusterIP` provides a single IP address for the set of Pods the Service is pointing to. This IP address is accessible only within the cluster.
|
||||
-->
|
||||
应用的 `redis-slave` 和 `redis-master` 服务只能在容器集群中访问,因为服务的默认类型是
|
||||
[ClusterIP](/zh/docs/concepts/Services-networking/Service/#publishingservices-Service-types)。`ClusterIP` 为服务指向的 Pod 集提供一个 IP 地址。这个 IP 地址只能在集群中访问。
|
||||
应用的 `mongo` 服务只能在 Kubernetes 集群中访问,因为服务的默认类型是
|
||||
[ClusterIP](/zh/docs/concepts/services-networking/service/#publishing-services---service-types)。`ClusterIP` 为服务指向的 Pod 集提供一个 IP 地址。这个 IP 地址只能在集群中访问。
|
||||
|
||||
<!--
|
||||
If you want guests to be able to access your guestbook, you must configure the frontend Service to be externally visible, so a client can request the Service from outside the container cluster. Minikube can only expose Services through `NodePort`.
|
||||
If you want guests to be able to access your guestbook, you must configure the frontend Service to be externally visible, so a client can request the Service from outside the Kubernetes cluster. However a Kubernetes user you can use `kubectl port-forward` to access the service even though it uses a `ClusterIP`.
|
||||
-->
|
||||
如果您希望客人能够访问您的留言板,您必须将前端服务配置为外部可见的,以便客户机可以从容器集群之外请求服务。Minikube 只能通过 `NodePort` 公开服务。
|
||||
如果您希望访客能够访问您的留言板,您必须将前端服务配置为外部可见的,以便客户端可以从 Kubernetes 集群之外请求服务。然而即便使用了 `ClusterIP` Kubernets 用户仍可以通过 `kubectl port-forwart` 访问服务。
|
||||
|
||||
<!--
|
||||
Some cloud providers, like Google Compute Engine or Google Kubernetes Engine, support external load balancers. If your cloud provider supports load balancers and you want to use it, uncomment `type: LoadBalancer`.
|
||||
-->
|
||||
{{< note >}}
|
||||
|
||||
<!--
|
||||
Some cloud providers, like Google Compute Engine or Google Kubernetes Engine, support external load balancers. If your cloud provider supports load balancers and you want to use it, simply delete or comment out `type: NodePort`, and uncomment `type: LoadBalancer`.
|
||||
-->
|
||||
一些云提供商,如 Google Compute Engine 或 Google Kubernetes Engine,支持外部负载均衡器。如果您的云提供商支持负载均衡器,并且您希望使用它,
|
||||
只需删除或注释掉 `type: NodePort`,并取消注释 `type: LoadBalancer` 即可。
|
||||
|
||||
只需取消注释 `type: LoadBalancer` 即可。
|
||||
{{< /note >}}
|
||||
|
||||
{{< codenew file="application/guestbook/frontend-service.yaml" >}}
|
||||
@@ -387,6 +282,11 @@ Some cloud providers, like Google Compute Engine or Google Kubernetes Engine, su
|
||||
kubectl apply -f https://k8s.io/examples/application/guestbook/frontend-service.yaml
|
||||
```
|
||||
|
||||
<!---
|
||||
for local testing of the content via relative file path
|
||||
kubectl apply -f ./content/en/examples/application/guestbook/frontend-service.yaml
|
||||
-->
|
||||
|
||||
<!--
|
||||
1. Query the list of Services to verify that the frontend Service is running:
|
||||
-->
|
||||
@@ -403,30 +303,24 @@ Some cloud providers, like Google Compute Engine or Google Kubernetes Engine, su
|
||||
|
||||
```
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
frontend NodePort 10.0.0.112 <none> 80:31323/TCP 6s
|
||||
frontend ClusterIP 10.0.0.112 <none> 80/TCP 6s
|
||||
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 4m
|
||||
redis-master ClusterIP 10.0.0.151 <none> 6379/TCP 2m
|
||||
redis-slave ClusterIP 10.0.0.223 <none> 6379/TCP 1m
|
||||
mongo ClusterIP 10.0.0.151 <none> 6379/TCP 2m
|
||||
```
|
||||
|
||||
<!--
|
||||
### Viewing the Frontend Service via `NodePort`
|
||||
### Viewing the Frontend Service via `kubectl port-forward`
|
||||
-->
|
||||
|
||||
### 通过 `NodePort` 查看前端服务
|
||||
### 通过 `kubectl port-forward` 查看前端服务
|
||||
|
||||
<!--
|
||||
If you deployed this application to Minikube or a local cluster, you need to find the IP address to view your Guestbook.
|
||||
1. Run the following command to forward port `8080` on your local machine to port `80` on the service.
|
||||
-->
|
||||
如果您将此应用程序部署到 Minikube 或本地集群,您需要找到 IP 地址来查看您的留言板。
|
||||
|
||||
<!--
|
||||
1. Run the following command to get the IP address for the frontend Service.
|
||||
-->
|
||||
1. 运行以下命令获取前端服务的 IP 地址。
|
||||
1. 运行以下命令将本机的 `8080` 端口转发到服务的 `80` 端口。
|
||||
|
||||
```shell
|
||||
minikube service frontend --url
|
||||
kubectl port-forward svc/frontend 8080:80
|
||||
```
|
||||
|
||||
<!--
|
||||
@@ -435,13 +329,14 @@ If you deployed this application to Minikube or a local cluster, you need to fin
|
||||
响应应该与此类似:
|
||||
|
||||
```
|
||||
http://192.168.99.100:31323
|
||||
Forwarding from 127.0.0.1:8080 -> 80
|
||||
Forwarding from [::1]:8080 -> 80
|
||||
```
|
||||
|
||||
<!--
|
||||
1. Copy the IP address, and load the page in your browser to view your guestbook.
|
||||
1. load the page [http://localhost:8080](http://localhost:8080) in your browser to view your guestbook.
|
||||
-->
|
||||
2. 复制 IP 地址,然后在浏览器中加载页面以查看留言板。
|
||||
2. 在浏览器中加载 [http://localhost:8080](http://localhost:8080) 页面以查看留言板。
|
||||
|
||||
<!--
|
||||
### Viewing the Frontend Service via `LoadBalancer`
|
||||
@@ -519,9 +414,7 @@ Scaling up or down is easy because your servers are defined as a Service that us
|
||||
frontend-3823415956-k22zn 1/1 Running 0 54m
|
||||
frontend-3823415956-w9gbt 1/1 Running 0 54m
|
||||
frontend-3823415956-x2pld 1/1 Running 0 5s
|
||||
redis-master-1068406935-3lswp 1/1 Running 0 56m
|
||||
redis-slave-2005841000-fpvqc 1/1 Running 0 55m
|
||||
redis-slave-2005841000-phfv9 1/1 Running 0 55m
|
||||
mongo-1068406935-3lswp 1/1 Running 0 56m
|
||||
```
|
||||
|
||||
<!--
|
||||
@@ -551,9 +444,7 @@ Scaling up or down is easy because your servers are defined as a Service that us
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
frontend-3823415956-k22zn 1/1 Running 0 1h
|
||||
frontend-3823415956-w9gbt 1/1 Running 0 1h
|
||||
redis-master-1068406935-3lswp 1/1 Running 0 1h
|
||||
redis-slave-2005841000-fpvqc 1/1 Running 0 1h
|
||||
redis-slave-2005841000-phfv9 1/1 Running 0 1h
|
||||
mongo-1068406935-3lswp 1/1 Running 0 1h
|
||||
```
|
||||
|
||||
|
||||
@@ -569,13 +460,13 @@ Deleting the Deployments and Services also deletes any running Pods. Use labels
|
||||
<!--
|
||||
1. Run the following commands to delete all Pods, Deployments, and Services.
|
||||
-->
|
||||
5. 运行以下命令以删除所有 Pod,Deployments 和 Services。
|
||||
1. 运行以下命令以删除所有 Pod,Deployments 和 Services。
|
||||
|
||||
```shell
|
||||
kubectl delete deployment -l app=redis
|
||||
kubectl delete service -l app=redis
|
||||
kubectl delete deployment -l app=guestbook
|
||||
kubectl delete service -l app=guestbook
|
||||
kubectl delete deployment -l app.kubernetes.io/name=mongo
|
||||
kubectl delete service -l app.kubernetes.io/name=mongo
|
||||
kubectl delete deployment -l app.kubernetes.io/name=guestbook
|
||||
kubectl delete service -l app.kubernetes.io/name=guestbook
|
||||
```
|
||||
|
||||
<!--
|
||||
@@ -584,10 +475,8 @@ Deleting the Deployments and Services also deletes any running Pods. Use labels
|
||||
响应应该是:
|
||||
|
||||
```
|
||||
deployment.apps "redis-master" deleted
|
||||
deployment.apps "redis-slave" deleted
|
||||
service "redis-master" deleted
|
||||
service "redis-slave" deleted
|
||||
deployment.apps "mongo" deleted
|
||||
service "mongo" deleted
|
||||
deployment.apps "frontend" deleted
|
||||
service "frontend" deleted
|
||||
```
|
||||
@@ -595,7 +484,7 @@ Deleting the Deployments and Services also deletes any running Pods. Use labels
|
||||
<!--
|
||||
1. Query the list of Pods to verify that no Pods are running:
|
||||
-->
|
||||
6. 查询 Pod 列表,确认没有 Pod 在运行:
|
||||
2. 查询 Pod 列表,确认没有 Pod 在运行:
|
||||
|
||||
```shell
|
||||
kubectl get pods
|
||||
@@ -616,15 +505,12 @@ Deleting the Deployments and Services also deletes any running Pods. Use labels
|
||||
|
||||
|
||||
<!--
|
||||
* Add [ELK logging and monitoring](/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk/) to your Guestbook application
|
||||
* Complete the [Kubernetes Basics](/docs/tutorials/kubernetes-basics/) Interactive Tutorials
|
||||
* 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)
|
||||
* Read more about [connecting applications](/docs/concepts/services-networking/connect-applications-service/)
|
||||
* Read more about [Managing Resources](/docs/concepts/cluster-administration/manage-deployment/#using-labels-effectively)
|
||||
-->
|
||||
|
||||
* 为 Guestbook 应用添加
|
||||
[ELK 日志与监控](/zh/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk/)
|
||||
* 完成 [Kubernetes Basics](/zh/docs/tutorials/kubernetes-basics/) 交互式教程
|
||||
* 使用 Kubernetes 创建一个博客,使用 [MySQL 和 Wordpress 的持久卷](/zh/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/#visit-your-new-wordpress-blog)
|
||||
* 阅读更多关于[连接应用程序](/zh/docs/concepts/services-networking/connect-applications-service/)
|
||||
|
||||
Reference in New Issue
Block a user