[zh-cn] sync istio-ingress-gateway logs-istio enable-istio-all-microservices production-testing (#13196)

Signed-off-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
my-git9 2023-05-16 09:40:13 +08:00 committed by GitHub
parent 130d8d7ece
commit 900ced591d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 69 additions and 34 deletions

View File

@ -7,7 +7,9 @@ owner: istio/wg-docs-maintainers
test: no
---
之前,您在 `productpage` 微服务中启用了 Istio。为了在微服务中获取更多的 Istio 功能,您可以逐步的在微服务中启用 Istio。本教程的教学目的是让您能够在其余所有微服务上一步到位的启用 Istio。
之前,您在 `productpage` 微服务中启用了 Istio。为了在微服务中获取更多的
Istio 功能,您可以逐步的在微服务中启用 Istio。
本教程的教学目的是让您能够在其余所有微服务上一步到位的启用 Istio。
1. 为了教学目的将微服务的部署规模缩小为1
@ -15,7 +17,9 @@ test: no
$ kubectl scale deployments --all --replicas 1
{{< /text >}}
1. 重新部署启用 Istio 的 Bookinfo 应用。`productpage` 服务不会被重新部署,因为它被 Istio 注入,并且它的 Pod 不会发生改变。在这您可以在单个副本的微服务集群中启用 Istio 。
1. 重新部署启用 Istio 的 Bookinfo 应用。`productpage`
服务不会被重新部署,因为它被 Istio 注入,并且它的 Pod 不会发生改变。
在这您可以在单个副本的微服务集群中启用 Istio。
{{< text bash >}}
$ curl -s {{< github_file >}}/samples/bookinfo/platform/kube/bookinfo.yaml | istioctl kube-inject -f - | kubectl apply -l app!=reviews -f -
@ -33,9 +37,11 @@ test: no
deployment.apps/reviews-v2 configured
{{< /text >}}
1. 多次访问应用的网页。需要注意的是 Istio 的添加是无侵入的,原有的应用不会发生变化。它是在运行过程中添加的,不需要撤销和重新部署整个应用程序。
1. 多次访问应用的网页。需要注意的是 Istio 的添加是无侵入的,
原有的应用不会发生变化。它是在运行过程中添加的,不需要撤销和重新部署整个应用程序。
1. 检查应用程序 Pod并验证现在每个 Pod 的两个容器。 一个容器是微服务本身,另一个是连接到它的 Sidecar 代理。
1. 检查应用程序 Pod并验证现在每个 Pod 的两个容器。
一个容器是微服务本身,另一个是连接到它的 Sidecar 代理。
{{< text bash >}}
$ kubectl get pods
@ -46,27 +52,33 @@ test: no
sleep-88ddbcfdd-cc85s 1/1 Running 0 7h
{{< /text >}}
1. 通过自定义的 URL 检查 Istio 仪表盘,它配置在您[之前配置](/zh/docs/examples/microservices-istio/bookinfo-kubernetes/#update-your-etc-hosts-configuration-file)的 `/etc/hosts` 文件中:
1. 通过自定义的 URL 检查 Istio 仪表盘,
它配置在您[之前配置](/zh/docs/examples/microservices-istio/bookinfo-kubernetes/#update-your-etc-hosts-configuration-file)的
`/etc/hosts` 文件中:
{{< text plain >}}
http://my-istio-dashboard.io/dashboard/db/istio-mesh-dashboard
{{< /text >}}
1. 在左上角的下拉菜单中,选择 _Istio Mesh Dashboard_。注意现在您的命名空间的所有服务都会出现在服务列表中。
1. 在左上角的下拉菜单中,选择 **Istio Mesh Dashboard**
注意现在您的命名空间的所有服务都会出现在服务列表中。
{{< image width="80%"
link="dashboard-mesh-all.png"
caption="Istio Mesh Dashboard"
>}}
1. 在 _Istio Service Dashboard_ 仪表盘中检查其他微服务,如 `ratings` 等:
1. 在 **Istio Service Dashboard** 仪表盘中检查其他微服务,如 `ratings` 等:
{{< image width="80%"
link="dashboard-ratings.png"
caption="Istio Service Dashboard"
>}}
1. 通过 [Kiali](https://www.kiali.io) 控住台的可视化界面来查看您的应用程序的拓扑结构,它不是 Istio 的一部分,而是作为 `demo` 配置安装的一部分。通过自定义的 URL 进入仪表盘,它配置在您[之前配置](/zh/docs/examples/microservices-istio/bookinfo-kubernetes/#update-your-etc-hosts-configuration-file) 的 `/etc/hosts` 文件中:
1. 通过 [Kiali](https://www.kiali.io) 控住台的可视化界面来查看您的应用程序的拓扑结构,
它不是 Istio 的一部分,而是作为 `demo` 配置安装的一部分。通过自定义的 URL 进入仪表盘,
它配置在您[之前配置](/zh/docs/examples/microservices-istio/bookinfo-kubernetes/#update-your-etc-hosts-configuration-file)
`/etc/hosts` 文件中:
{{< text plain >}}
http://my-kiali.io/kiali/console
@ -74,14 +86,17 @@ test: no
如果您的 Kiali 是通过 [入门指南](/zh/docs/setup/getting-started/) 安装的Kiali 控制台用户名是 `admin`,密码是 `admin`
1. 点击 `Graph` 按钮,并且在顶部角落的 _Namespace_ 下拉菜单中选择您的命名空间。然后在 _Display_ 下拉菜单中选中 _Traffic Animation_ 复选框,就可以看到一些很酷的流量动画。
1. 点击 `Graph` 按钮,并且在顶部角落的 **Namespace**
下拉菜单中选择您的命名空间。然后在 **Display** 下拉菜单中选中
**Traffic Animation** 复选框,就可以看到一些很酷的流量动画。
{{< image width="80%"
link="kiali-display-menu.png"
caption="Kiali Graph Tab, display drop-down menu"
>}}
1. 尝试在 _Edge Labels_ 下拉菜单中选择不同的选项。将鼠标悬停在图的节点和边上。注意右边的流量指标。
1. 尝试在 **Edge Labels** 下拉菜单中选择不同的选项。
将鼠标悬停在图的节点和边上。注意右边的流量指标。
{{< image width="80%"
link="kiali-edge-labels-menu.png"

View File

@ -7,7 +7,8 @@ owner: istio/wg-docs-maintainers
test: no
---
到目前为止,您可以通过 Kubernetes Ingress 在外部去访问您的应用。在本模块,您可以通过 Istio Ingress Gateway 配置流量,以便在微服务中通过使用 Istio 控制流量。
到目前为止,您可以通过 Kubernetes Ingress 在外部去访问您的应用。在本模块,
您可以通过 Istio Ingress Gateway 配置流量,以便在微服务中通过使用 Istio 控制流量。
1. 在环境变量中存储命名空间 `NAMESPACE`。您需要通过它在日志中辨别您的微服务。
@ -71,7 +72,8 @@ test: no
EOF
{{< /text >}}
1. 在 [确定 Ingress IP 和 Port](/zh/docs/tasks/traffic-management/ingress/ingress-control/#determining-the-ingress-ip-and-ports) 部分可以使用指令设置 `INGRESS_HOST``INGRESS_PORT`
1. 在[确定 Ingress IP 和 Port](/zh/docs/tasks/traffic-management/ingress/ingress-control/#determining-the-ingress-ip-and-ports)
部分可以使用指令设置 `INGRESS_HOST``INGRESS_PORT`
1. 将该命令的输出添加到您的 `/etc/hosts` 文件中。
@ -103,16 +105,23 @@ test: no
...
{{< /text >}}
1. 在 Kiali 控制台 `my-kiali.io/kiali/console` 通过 Graph 检查您的命名空间。(这个 `my-kiali.io` URL 设置在您[之前配置](/zh/docs/examples/microservices-istio/bookinfo-kubernetes/#update-your-etc-hosts-configuration-file) 的 `/etc/hosts` 文件中)。
1. 在 Kiali 控制台 `my-kiali.io/kiali/console` 通过 Graph
检查您的命名空间。(这个 `my-kiali.io` URL
设置在您[之前配置](/zh/docs/examples/microservices-istio/bookinfo-kubernetes/#update-your-etc-hosts-configuration-file)
`/etc/hosts` 文件中)。
在这,您可以看到有两个来源的流量,一个是 `unknown`Kubernetes Ingress一个是`istio-ingressgateway istio-system`Istio Ingress Gateway
在这,您可以看到有两个来源的流量,一个是 `unknown`Kubernetes Ingress
一个是 `istio-ingressgateway istio-system`Istio Ingress Gateway
{{< image width="80%"
link="kiali-ingress-gateway.png"
caption="Kiali Graph Tab with Istio Ingress Gateway"
>}}
1. 此时您可以停止发送 Kubernetes Ingress 请求只使用Istio Ingress Gateway。停止您之前设置的无限循环在终端窗口使用 `Ctrl-C`)。在真实的生产环境中,您需要更新应用的 DNS 条目,使其包含 Istio ingress gateway 的 IP或者配置您的外部负载均衡器。
1. 此时您可以停止发送 Kubernetes Ingress 请求只使用Istio Ingress Gateway。
停止您之前设置的无限循环(在终端窗口使用 `Ctrl-C`)。在真实的生产环境中,
您需要更新应用的 DNS 条目,使其包含 Istio ingress gateway 的 IP
或者配置您的外部负载均衡器。
1. 删除Kubernetes Ingress 资源:

View File

@ -9,17 +9,25 @@ test: no
监控是支持向微服务架构过渡的关键。
在 Istio 中,它默认就提供监控微服务之间的流量的功能。您可以使用 Istio Dashboard 来实时监控您的微服务。
在 Istio 中,它默认就提供监控微服务之间的流量的功能。
您可以使用 Istio Dashboard 来实时监控您的微服务。
Istio 集成了开箱即用的 [Prometheus 的时序数据库和监控系统](https://prometheus.io)。Prometheus 收集了各种流量相关的指标,并为其提供[丰富的查询语言](https://prometheus.io/docs/prometheus/latest/querying/basics/)。
Istio 集成了开箱即用的 [Prometheus 的时序数据库和监控系统](https://prometheus.io)。
Prometheus 收集了各种流量相关的指标,
并为其提供[丰富的查询语言](https://prometheus.io/docs/prometheus/latest/querying/basics/)。
请看下面几个 Prometheus 查询 Istio-related 的例子。
1. 通过 [http://my-istio-logs-database.io](http://my-istio-logs-database.io) 访问 Prometheus UI 界面。(这 `my-istio-logs-database.io` URL 在您[之前配置](/zh/docs/examples/microservices-istio/bookinfo-kubernetes/#update-your-etc-hosts-configuration-file)的 `/etc/hosts` 文件中)。
1. 通过 [http://my-istio-logs-database.io](http://my-istio-logs-database.io)
访问 Prometheus UI 界面。(这 `my-istio-logs-database.io` URL
在您[之前配置](/zh/docs/examples/microservices-istio/bookinfo-kubernetes/#update-your-etc-hosts-configuration-file)的
`/etc/hosts` 文件中)。
{{< image width="80%" link="prometheus.png" caption="Prometheus Query UI" >}}
1. 在 _Expression_ 输入框中运行以下示例查询。按下 _Execute_ 按钮,在 _Console_ 中查看查询结果。这个查询使用 `tutorial` 作为应用的命名空间,您可以替换成您自己的命名空间。在查询数据时,为了能够得到更棒的效果,请运行前面步骤中描述的实时流量模拟器。
1. 在 **Expression** 输入框中运行以下示例查询。按下 **Execute** 按钮,在 **Console**
中查看查询结果。这个查询使用 `tutorial` 作为应用的命名空间,您可以替换成您自己的命名空间。
在查询数据时,为了能够得到更棒的效果,请运行前面步骤中描述的实时流量模拟器。
1. 查询命名空间的所有请求:
@ -45,9 +53,12 @@ Istio 集成了开箱即用的 [Prometheus 的时序数据库和监控系统](ht
rate(istio_requests_total{destination_service_namespace="tutorial", reporter="destination",destination_service_name="reviews"}[5m])
{{< /text >}}
上面使用的请求采用 `istio_requests_total` 指标,这是一个标准的 Istio 指标。您可以观察其他指标,特别是 Envoy [Envoy](https://www.envoyproxy.io) 是 Istio 的 Sidecar 代理)。您可以在 _insert metric at cursor_ 下拉菜单的看到收集的数据记录。
上面使用的请求采用 `istio_requests_total` 指标,这是一个标准的 Istio 指标。
您可以观察其他指标,特别是 Envoy[Envoy](https://www.envoyproxy.io)
是 Istio 的 Sidecar 代理)。您可以在 **insert metric at cursor**
下拉菜单的看到收集的数据记录。
## 下一步{#next-steps}
## 下一步 {#next-steps}
祝贺完成本教程!
@ -68,6 +79,6 @@ Istio 集成了开箱即用的 [Prometheus 的时序数据库和监控系统](ht
- [Pod 和 Service](/zh/docs/ops/deployment/requirements/)
- [安装](/zh/docs/setup/)
## 加入 Istio 社区{#join-the-Istio-community}
## 加入 Istio 社区 {#join-the-Istio-community}
我们欢迎您通过加入 [Istio 社区](/zh/get-involved/) 提出并反馈问题。

View File

@ -10,7 +10,7 @@ test: no
在生产环境中测试您的微服务!
## 测试单个微服务{#testing-individual-microservices}
## 测试单个微服务 {#testing-individual-microservices}
1. 从测试 pod 中向服务之一发起 HTTP 请求:
@ -18,19 +18,19 @@ test: no
$ kubectl exec -it $(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}') -- curl http://ratings:9080/ratings/7
{{< /text >}}
## 混乱测试{#chaos-testing}
## 混乱测试 {#chaos-testing}
在生产环境中执行一些[混测试](http://www.boyter.org/2016/07/chaos-testing-engineering/)并查看您的应用程序如何反应。
进行每次混乱的操作后,请访问应用程序的网页,查看是否有任何更改。
使用 `kubectl get pods` 检查 pods 状态。
在生产环境中执行一些[混测试](http://www.boyter.org/2016/07/chaos-testing-engineering/)
并查看您的应用程序如何反应。进行每次混乱的操作后,请访问应用程序的网页,查看是否有任何更改。
使用 `kubectl get pods` 检查 Pod 状态。
1. 在 `details` 服务的一个 pod 中终止它。
1. 在 `details` 服务的一个 Pod 中终止它。
{{< text bash >}}
$ kubectl exec -it $(kubectl get pods -l app=details -o jsonpath='{.items[0].metadata.name}') -- pkill ruby
{{< /text >}}
1. 检查 pods 状态:
1. 检查 Pod 状态:
{{< text bash >}}
$ kubectl get pods
@ -50,9 +50,9 @@ test: no
sleep-88ddbcfdd-l9zq4 1/1 Running 0 47m
{{< /text >}}
请注意第一个 pod 重启了一次。
请注意第一个 Pod 重启了一次。
1. 在 `details` 的所有 pods 中终止它:
1. 在 `details` 的所有 Pod 中终止它:
{{< text bash >}}
$ for pod in $(kubectl get pods -l app=details -o jsonpath='{.items[*].metadata.name}'); do echo terminating $pod; kubectl exec -it $pod -- pkill ruby; done
@ -67,7 +67,7 @@ test: no
请注意详情部分显示的是错误信息而不是书籍详情。
1. 检查 pods 状态:
1. 检查 Pod 状态:
{{< text bash >}}
$ kubectl get pods
@ -87,8 +87,8 @@ test: no
sleep-88ddbcfdd-l9zq4 1/1 Running 0 48m
{{< /text >}}
第一个 pod 重启了两次,其它两个 `details` pods 重启了一次。
您可能会看到 `Error``CrashLoopBackOff` 状态,直到 pods 变为 `Running` 状态。
第一个 Pod 重启了两次,其它两个 `details` Pod 重启了一次。
您可能会看到 `Error``CrashLoopBackOff` 状态,直到 Pod 变为 `Running` 状态。
1. 在终端中使用 Ctrl-C 停止正在运行的无限循环,以模拟流量。