diff --git a/content/zh/docs/examples/bookinfo/index.md b/content/zh/docs/examples/bookinfo/index.md old mode 100644 new mode 100755 index 00ff5cf988..7bb91f8653 --- a/content/zh/docs/examples/bookinfo/index.md +++ b/content/zh/docs/examples/bookinfo/index.md @@ -1,6 +1,6 @@ --- -title: Bookinfo Application -description: Deploys a sample application composed of four separate microservices used to demonstrate various Istio features. +title: Bookinfo 应用 +description: 部署一个用于演示多种 Istio 特性的应用,由四个单独的微服务构成。 weight: 10 aliases: - /zh/docs/samples/bookinfo.html @@ -8,79 +8,67 @@ aliases: - /zh/docs/guides/bookinfo.html --- -This example deploys a sample application composed of four separate microservices used -to demonstrate various Istio features. The application displays information about a -book, similar to a single catalog entry of an online book store. Displayed -on the page is a description of the book, book details (ISBN, number of -pages, and so on), and a few book reviews. +这个示例部署了一个用于演示多种 Istio 特性的应用,该应用由四个单独的微服务构成。 +这个应用模仿在线书店的一个分类,显示一本书的信息。 +页面上会显示一本书的描述,书籍的细节(ISBN、页数等),以及关于这本书的一些评论。 -The Bookinfo application is broken into four separate microservices: +Bookinfo 应用分为四个单独的微服务: -* `productpage`. The `productpage` microservice calls the `details` and `reviews` microservices to populate the page. -* `details`. The `details` microservice contains book information. -* `reviews`. The `reviews` microservice contains book reviews. It also calls the `ratings` microservice. -* `ratings`. The `ratings` microservice contains book ranking information that accompanies a book review. +* `productpage`. 这个微服务会调用 `details` 和 `reviews` 两个微服务,用来生成页面。 +* `details`. 这个微服务中包含了书籍的信息。 +* `reviews`. 这个微服务中包含了书籍相关的评论。它还会调用 `ratings` 微服务。 +* `ratings`. 这个微服务中包含了由书籍评价组成的评级信息。 -There are 3 versions of the `reviews` microservice: +`reviews` 微服务有 3 个版本: -* Version v1 doesn't call the `ratings` service. -* Version v2 calls the `ratings` service, and displays each rating as 1 to 5 black stars. -* Version v3 calls the `ratings` service, and displays each rating as 1 to 5 red stars. +* v1 版本不会调用 `ratings` 服务。 +* v2 版本会调用 `ratings` 服务,并使用 1 到 5 个黑色星形图标来显示评分信息。 +* v3 版本会调用 `ratings` 服务,并使用 1 到 5 个红色星形图标来显示评分信息。 -The end-to-end architecture of the application is shown below. +下图展示了这个应用的端到端架构。 {{< image width="80%" link="./noistio.svg" caption="Bookinfo Application without Istio" >}} -This application is polyglot, i.e., the microservices are written in different languages. -It’s worth noting that these services have no dependencies on Istio, but make an interesting -service mesh example, particularly because of the multitude of services, languages and versions -for the `reviews` service. +Bookinfo 应用中的几个微服务是由不同的语言编写的。 +这些服务对 Istio 并无依赖,但是构成了一个有代表性的服务网格的例子:它由多个服务、多个语言构成,并且 `reviews` 服务具有多个版本。 -## Before you begin +## 开始之前{#before-you-begin} -If you haven't already done so, setup Istio by following the instructions -in the [installation guide](/docs/setup/). +如果您还没有开始,请遵循[安装指南](/zh/docs/setup/)完成 Istio 的部署工作。 -## Deploying the application +## 部署应用{#deploying-the-application} -To run the sample with Istio requires no changes to the -application itself. Instead, you simply need to configure and run the services in an -Istio-enabled environment, with Envoy sidecars injected along side each service. -The resulting deployment will look like this: +要在 Istio 中运行这一应用,无需对应用自身做出任何改变。 +您只要简单的在 Istio 环境中对服务进行配置和运行,具体一点说就是把 Envoy sidecar 注入到每个服务之中。 +最终的部署结果将如下图所示: {{< image width="80%" link="./withistio.svg" caption="Bookinfo Application" >}} -All of the microservices will be packaged with an Envoy sidecar that intercepts incoming -and outgoing calls for the services, providing the hooks needed to externally control, -via the Istio control plane, routing, telemetry collection, and policy enforcement -for the application as a whole. +所有的微服务都和 Envoy sidecar 集成在一起,被集成服务所有的出入流量都被 sidecar 所劫持,这样就为外部控制准备了所需的 Hook,然后就可以利用 Istio 控制平面为应用提供服务路由、遥测数据收集以及策略实施等功能。 -### Start the application services +### {#start-the-application-services} {{< tip >}} -If you use GKE, please ensure your cluster has at least 4 standard GKE nodes. If you use Minikube, please ensure you have at least 4GB RAM. +如果运行的是 GKE,请确您的集群具有至少四个标准 GKE 节点。如果使用的是 Minikube,应该有 4G 以上的内存。 {{< /tip >}} -1. Change directory to the root of the Istio installation. +1. 进入 Istio 安装目录。 -1. The default Istio installation uses [automatic sidecar injection](/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection). - Label the namespace that will host the application with `istio-injection=enabled`: +1. Istio 默认[自动注入 Sidecar](/zh/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection). + 请为 `default` 命名空间打上标签 `istio-injection=enabled`: {{< text bash >}} $ kubectl label namespace default istio-injection=enabled {{< /text >}} -1. Deploy your application using the `kubectl` command: +1. 使用 `kubectl` 部署应用: {{< text bash >}} $ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo.yaml@ {{< /text >}} {{< warning >}} - If you disabled automatic sidecar injection during installation and rely on [manual sidecar injection] - (/docs/setup/additional-setup/sidecar-injection/#manual-sidecar-injection), - use the [`istioctl kube-inject`](/docs/reference/commands/istioctl/#istioctl-kube-inject) command to modify the `bookinfo.yaml` - file before deploying your application. + 如果您在安装过程中禁用了 Sidecar 自动注入功能而选择[手动注入 Sidecar](/zh/docs/setup/additional-setup/sidecar-injection/#manual-sidecar-injection),请在部署应用之前使用 [`istioctl kube-inject`](/zh/docs/reference/commands/istioctl/#istioctl-kube-inject)命令修改 `bookinfo.yaml` 文件。 {{< text bash >}} $ kubectl apply -f <(istioctl kube-inject -f @samples/bookinfo/platform/kube/bookinfo.yaml@) @@ -88,15 +76,13 @@ If you use GKE, please ensure your cluster has at least 4 standard GKE nodes. If {{< /warning >}} - The command launches all four services shown in the `bookinfo` application architecture diagram. - All 3 versions of the reviews service, v1, v2, and v3, are started. + 上面的命令会启动全部的四个服务,其中也包括了 reviews 服务的三个版本(v1、v2 以及 v3)。 {{< tip >}} - In a realistic deployment, new versions of a microservice are deployed - over time instead of deploying all versions simultaneously. + 在实际部署中,微服务版本的启动过程需要持续一段时间,并不是同时完成的。 {{< /tip >}} -1. Confirm all services and pods are correctly defined and running: +1. 确认所有的服务和 Pod 都已经正确的定义和启动: {{< text bash >}} $ kubectl get services @@ -108,7 +94,7 @@ If you use GKE, please ensure your cluster has at least 4 standard GKE nodes. If reviews 10.0.0.170 9080/TCP 6m {{< /text >}} - and + 还有: {{< text bash >}} $ kubectl get pods @@ -121,27 +107,24 @@ If you use GKE, please ensure your cluster has at least 4 standard GKE nodes. If reviews-v3-1813607990-8ch52 2/2 Running 0 6m {{< /text >}} -1. To confirm that the Bookinfo application is running, send a request to it by a `curl` command from some pod, for - example from `ratings`: +1. 要确认 Bookinfo 应用是否正在运行,请在某个 Pod 中用 `curl` 命令对应用发送请求,例如 `ratings`: {{< text bash >}} $ kubectl exec -it $(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}') -c ratings -- curl productpage:9080/productpage | grep -o ".*" Simple Bookstore App {{< /text >}} -### Determine the ingress IP and port +### 确定 Ingress 的 IP 和端口{#determine-the-ingress-i-p-and-port} -Now that the Bookinfo services are up and running, you need to make the application accessible from outside of your -Kubernetes cluster, e.g., from a browser. An [Istio Gateway](/docs/concepts/traffic-management/#gateways) -is used for this purpose. +现在 Bookinfo 服务启动并运行中,您需要使应用程序可以从外部访问 Kubernetes 集群,例如使用浏览器。可以用 [Istio Gateway](/zh/docs/concepts/traffic-management/#gateways) 来实现这个目标。 -1. Define the ingress gateway for the application: +1. 为应用程序定义 Ingress 网关: {{< text bash >}} $ kubectl apply -f @samples/bookinfo/networking/bookinfo-gateway.yaml@ {{< /text >}} -1. Confirm the gateway has been created: +1. 确认网关创建完成: {{< text bash >}} $ kubectl get gateway @@ -149,76 +132,67 @@ is used for this purpose. bookinfo-gateway 32s {{< /text >}} -1. Follow [these instructions](/docs/tasks/traffic-management/ingress/ingress-control/#determining-the-ingress-ip-and-ports) to set the `INGRESS_HOST` and `INGRESS_PORT` variables for accessing the gateway. Return here, when they are set. +1. 根据[文档](/zh/docs/tasks/traffic-management/ingress/ingress-control/#determining-the-ingress-i-p-and-ports)设置访问网关的 `INGRESS_HOST` 和 `INGRESS_PORT` 变量。确认并设置。 -1. Set `GATEWAY_URL`: +1. 设置 `GATEWAY_URL`: {{< text bash >}} $ export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT {{< /text >}} -## Confirm the app is accessible from outside the cluster +## 确认可以从集群外部访问应用{#confirm-the-app-is-accessible-from-outside-the-cluster} -To confirm that the Bookinfo application is accessible from outside the cluster, run the following `curl` command: +可以用 `curl` 命令来确认是否能够从集群外部访问 Bookinfo 应用程序: {{< text bash >}} $ curl -s http://${GATEWAY_URL}/productpage | grep -o ".*" Simple Bookstore App {{< /text >}} -You can also point your browser to `http://$GATEWAY_URL/productpage` -to view the Bookinfo web page. If you refresh the page several times, you should -see different versions of reviews shown in `productpage`, presented in a round robin style (red -stars, black stars, no stars), since we haven't yet used Istio to control the -version routing. +还可以用浏览器打开网址 `http://$GATEWAY_URL/productpage`,来浏览应用的 Web 页面。如果刷新几次应用的页面,就会看到 `productpage` 页面中会随机展示 `reviews` 服务的不同版本的效果(红色、黑色的星形或者没有显示)。`reviews` 服务出现这种情况是因为我们还没有使用 Istio 来控制版本的路由。 -## Apply default destination rules +## 应用默认目标规则{#apply-default-destination-rules} -Before you can use Istio to control the Bookinfo version routing, you need to define the available -versions, called *subsets*, in [destination rules](/docs/concepts/traffic-management/#destination-rules). +在使用 Istio 控制 Bookinfo 版本路由之前,您需要在[目标规则](/zh/docs/concepts/traffic-management/#destination-rules)中定义好可用的版本,命名为 *subsets* 。 -Run the following command to create default destination rules for the Bookinfo services: +运行以下命令为 Bookinfo 服务创建的默认的目标规则: -* If you did **not** enable mutual TLS, execute this command: +* 如果**没有**启用双向TLS,请执行以下命令: {{< text bash >}} $ kubectl apply -f @samples/bookinfo/networking/destination-rule-all.yaml@ {{< /text >}} -* If you **did** enable mutual TLS, execute this command: +* 如果**启用了**双向 TLS,请执行以下命令: {{< text bash >}} $ kubectl apply -f @samples/bookinfo/networking/destination-rule-all-mtls.yaml@ {{< /text >}} -Wait a few seconds for the destination rules to propagate. +等待几秒钟,以使目标规则生效。 -You can display the destination rules with the following command: +您可以使用以下命令查看目标规则: {{< text bash >}} $ kubectl get destinationrules -o yaml {{< /text >}} -## What's next +## 下一步{#what-s-next} -You can now use this sample to experiment with Istio's features for -traffic routing, fault injection, rate limiting, etc. -To proceed, refer to one or more of the [Istio Tasks](/docs/tasks), -depending on your interest. [Configuring Request Routing](/docs/tasks/traffic-management/request-routing/) -is a good place to start for beginners. +现在就可以使用这一应用来体验 Istio 的特性了,其中包括了流量的路由、错误注入、速率限制等。 +接下来可以根据个人爱好去阅读和演练 [Istio 实例](/zh/docs/tasks)。这里为新手推荐[智能路由](/zh/docs/tasks/traffic-management/request-routing/)功能作为起步课程。 -## Cleanup +## 清理{#cleanup} -When you're finished experimenting with the Bookinfo sample, uninstall and clean -it up using the following instructions: +结束对 Bookinfo 示例应用的体验之后,就可以使用下面的命令来完成应用的删除和清理了: -1. Delete the routing rules and terminate the application pods +1. 删除路由规则,并销毁应用的 Pod {{< text bash >}} $ @samples/bookinfo/platform/kube/cleanup.sh@ {{< /text >}} -1. Confirm shutdown +1. 确认应用已经关停 {{< text bash >}} $ kubectl get virtualservices #-- there should be no virtual services diff --git a/content/zh/docs/tasks/traffic-management/request-routing/index.md b/content/zh/docs/tasks/traffic-management/request-routing/index.md index 141808f341..70b5dc0f02 100644 --- a/content/zh/docs/tasks/traffic-management/request-routing/index.md +++ b/content/zh/docs/tasks/traffic-management/request-routing/index.md @@ -120,7 +120,7 @@ Istio [Bookinfo](/zh/docs/examples/bookinfo/) 示例包含四个独立的微服 您可以通过再次刷新 Bookinfo 应用程序的 `/productpage` 轻松测试新配置。 -1. 在浏览器中打开 Bookinfo 站点。 网址为 `http://$GATEWAY_URL/productpage`,其中 `$GATEWAY_URL` 是外部的入口 IP 地址,如 [Bookinfo](/zh/docs/examples/bookinfo/#determine-the-ingress-ip-and-port) 文档中所述。 +1. 在浏览器中打开 Bookinfo 站点。 网址为 `http://$GATEWAY_URL/productpage`,其中 `$GATEWAY_URL` 是外部的入口 IP 地址,如 [Bookinfo](/zh/docs/examples/bookinfo/#determine-the-ingress-i-p-and-port) 文档中所述。 请注意,无论您刷新多少次,页面的评论部分都不会显示评级星标。这是因为您将 Istio 配置为 将评论服务的所有流量路由到版本 `reviews:v1`,而此版本的服务不访问星级评分服务。 diff --git a/content/zh/docs/tasks/traffic-management/traffic-shifting/index.md b/content/zh/docs/tasks/traffic-management/traffic-shifting/index.md index 8240fef40a..af2d5a7cf6 100644 --- a/content/zh/docs/tasks/traffic-management/traffic-shifting/index.md +++ b/content/zh/docs/tasks/traffic-management/traffic-shifting/index.md @@ -32,7 +32,7 @@ aliases: $ kubectl apply -f @samples/bookinfo/networking/virtual-service-all-v1.yaml@ {{< /text >}} -1. 在浏览器中打开 Bookinfo 站点。网址为 `http://$GATEWAY_URL/productpage`,其中 `$GATEWAY_URL` 是 ingress 的外部 IP 地址,其描述参见 [Bookinfo](/zh/docs/examples/bookinfo/#determine-the-ingress-ip-and-port) 文档。 +1. 在浏览器中打开 Bookinfo 站点。网址为 `http://$GATEWAY_URL/productpage`,其中 `$GATEWAY_URL` 是 ingress 的外部 IP 地址,其描述参见 [Bookinfo](/zh/docs/examples/bookinfo/#determine-the-ingress-i-p-and-port) 文档。 请注意,不管刷新多少次,页面的评论部分都不会显示评级星号。 这是因为 Istio 被配置为将 reviews 服务的的所有流量都路由到了 `reviews:v1` 版本,