mirror of https://github.com/istio/istio.io.git
zh-retranslation:content/zh/docs/setup/getting-started/index.md (#8600)
fix auto-test
This commit is contained in:
parent
83023db095
commit
b8836d0db9
|
|
@ -1,175 +1,426 @@
|
||||||
---
|
---
|
||||||
title: 开始
|
title: 入门
|
||||||
description: 下载、安装并学习如何快速使用 Istio 的基本特性。
|
description: 快速、轻松地尝试 Istio 特性。
|
||||||
weight: 5
|
weight: 5
|
||||||
aliases:
|
aliases:
|
||||||
- /zh/docs/setup/kubernetes/getting-started/
|
- /zh/docs/setup/kubernetes/getting-started/
|
||||||
- /zh/docs/setup/kubernetes/
|
- /zh/docs/setup/kubernetes/
|
||||||
- /zh/docs/setup/kubernetes/install/kubernetes/
|
- /zh/docs/setup/kubernetes/install/kubernetes/
|
||||||
keywords: [getting-started, install, bookinfo, quick-start, kubernetes]
|
keywords: [getting-started, install, bookinfo, quick-start, kubernetes]
|
||||||
|
test: yes
|
||||||
---
|
---
|
||||||
|
|
||||||
本指南面向 Istio 的新用户,让您通过安装 `demo` [配置文件](/zh/docs/setup/additional-setup/config-profiles/)快速评估 Istio。
|
本指南帮你快速评估 Istio。
|
||||||
|
如果你已经熟悉 Istio,或兴趣点在安装其他配置类型、
|
||||||
|
高级[部署模型](/zh/docs/ops/deployment/deployment-models/),
|
||||||
|
请参阅[我们应该采用哪种 Istio 安装方法?](/zh/faq/setup/#install-method-selection) 的 FAQ 页面。
|
||||||
|
|
||||||
如果您已经熟悉 Istio 或对安装其他配置文件或更高级的[部署模型](/zh/docs/ops/deployment/deployment-models/)感兴趣,
|
完成下面步骤需要你有一个 {{< gloss >}}cluster{{< /gloss >}},
|
||||||
请遵循[使用 {{< istioctl >}} 的安装说明文档](/zh/docs/setup/install/istioctl)。
|
且运行着兼容版本的 Kubernetes ({{< supported_kubernetes_versions >}})。
|
||||||
|
你可以使用任何受支持的平台,例如:
|
||||||
|
[Minikube](https://kubernetes.io/zh/docs/tasks/tools/install-minikube/)
|
||||||
|
或[特定平台安装说明](/zh/docs/setup/platform-setup/)
|
||||||
|
章节中指定的其他平台。
|
||||||
|
|
||||||
{{< warning >}}
|
请按照以下步骤开始使用 Istio:
|
||||||
此 demo 配置文件不适用于性能评估。它旨在展示 Istio 高水平跟踪和访问日志的功能。
|
|
||||||
{{< /warning >}}
|
|
||||||
|
|
||||||
要开始使用 Istio,只需遵循以下三个步骤:
|
1. [下载并安装 Istio](#download)
|
||||||
|
1. [部署示例应用程序](#bookinfo)
|
||||||
1. [搭建平台](#platform)
|
1. [对外开放应用程序](#ip)
|
||||||
1. [下载 Istio](#download)
|
1. [查看仪表板](#dashboard)
|
||||||
1. [安装 Istio](#install)
|
|
||||||
|
|
||||||
## 搭建平台 {#platform}
|
|
||||||
|
|
||||||
在安装 Istio 之前,需要一个运行着 Kubernetes 的兼容版本的 {{< gloss >}}cluster{{< /gloss >}}。
|
|
||||||
|
|
||||||
Istio {{< istio_version >}} 已经在 Kubernetes 版本 {{< supported_kubernetes_versions >}} 中测试过。
|
|
||||||
|
|
||||||
- 通过选择合适的 [platform-specific setup instructions](/zh/docs/setup/platform-setup/) 来创建一个集群。
|
|
||||||
|
|
||||||
有些平台提供了 {{< gloss >}}managed control plane{{< /gloss >}},您可以使用它来代替手动安装 Istio。如果您选择的平台支持这种方式,并且您选择使用它,那么,在创建完集群后,您将完成 Istio 的安装。因此,可以跳过以下说明。
|
|
||||||
|
|
||||||
## 下载 Istio {#download}
|
## 下载 Istio {#download}
|
||||||
|
|
||||||
下载 Istio,下载内容将包含:安装文件、示例和 [{{< istioctl >}}](/zh/docs/reference/commands/istioctl/) 命令行工具。
|
1. 转到 [Istio 发布]({{< istio_release_url >}}) 页面,下载针对你操作系统的安装文件,
|
||||||
|
或用自动化工具下载并提取最新版本(Linux 或 macOS):
|
||||||
1. 访问 [Istio release]({{< istio_release_url >}}) 页面下载与您操作系统对应的安装文件。在 macOS 或 Linux 系统中,也可以通过以下命令下载最新版本的 Istio:
|
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ curl -L https://istio.io/downloadIstio | sh -
|
$ curl -L https://istio.io/downloadIstio | sh -
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
1. 切换到 Istio 包所在目录下。例如:Istio 包名为 `istio-{{< istio_full_version >}}`,则:
|
{{< tip >}}
|
||||||
|
上面的命令下载最新版本(用数值表示)的 Istio。
|
||||||
|
你可以给命令行传递变量,用来下载指定的、不同处理器体系的版本。
|
||||||
|
例如,下载 x86_64 架构的、1.6.8 版本的 Istio ,运行:
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
|
$ curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.6.8 TARGET_ARCH=x86_64 sh -
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
{{< /tip >}}
|
||||||
|
|
||||||
|
1. 转到 Istio 包目录。例如,如果包是 `istio-{{< istio_full_version >}}`:
|
||||||
|
|
||||||
|
{{< text syntax=bash snip_id=none >}}
|
||||||
$ cd istio-{{< istio_full_version >}}
|
$ cd istio-{{< istio_full_version >}}
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
安装目录包含如下内容:
|
安装目录包含:
|
||||||
|
|
||||||
- `install/kubernetes` 目录下,有 Kubernetes 相关的 YAML 安装文件
|
- `samples/` 目录下的示例应用程序
|
||||||
- `samples/` 目录下,有示例应用程序
|
- `bin/` 目录下的 [`istioctl`](/zh/docs/reference/commands/istioctl) 客户端二进制文件
|
||||||
- `bin/` 目录下,包含 [`istioctl`](/zh/docs/reference/commands/istioctl) 的客户端文件。`istioctl` 工具用于手动注入 Envoy sidecar 代理。
|
.
|
||||||
|
|
||||||
1. 将 `istioctl` 客户端路径增加到 path 环境变量中,macOS 或 Linux 系统的增加方式如下:
|
1. 将 `istioctl` 客户端加入搜索路径(Linux or macOS):
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ export PATH=$PWD/bin:$PATH
|
$ export PATH=$PWD/bin:$PATH
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
1. 在使用 bash 或 ZSH 控制台时,可以选择启动 [auto-completion option](/zh/docs/ops/diagnostic-tools/istioctl#enabling-auto-completion)。
|
|
||||||
|
|
||||||
## 安装 Istio {#install}
|
## 安装 Istio {#install}
|
||||||
|
|
||||||
请按照以下步骤在您所选的平台上使用 `demo` 配置文件安装 Istio。
|
1. 对于本次安装,我们采用 `demo`
|
||||||
|
[配置组合](/zh/docs/setup/additional-setup/config-profiles/)。
|
||||||
|
选择它是因为它包含了一组专为测试准备的功能集合,另外还有用于生产或性能测试的配置组合。
|
||||||
|
|
||||||
1. 安装 `demo` 配置
|
{{< warning >}}
|
||||||
|
如果你的平台有供应商提供的配置组合,比如:Openshift,则在下面命令中替换掉 `demo` 配置项。更多细节请参阅你的 [平台说明](/zh/docs/setup/platform-setup/)
|
||||||
|
{{< /warning >}}
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ istioctl manifest apply --set profile=demo
|
$ istioctl install --set profile=demo -y
|
||||||
|
✔ Istio core installed
|
||||||
|
✔ Istiod installed
|
||||||
|
✔ Egress gateways installed
|
||||||
|
✔ Ingress gateways installed
|
||||||
|
✔ Installation complete
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
1. 为了验证是否安装成功,需要先确保以下 Kubernetes 服务正确部署,然后验证除 `jaeger-agent` 服务外的其他服务,是否均有正确的 `CLUSTER-IP`:
|
1. 给命名空间添加标签,指示 Istio 在部署应用的时候,自动的注入 Envoy 边车代理:
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ kubectl get svc -n istio-system
|
$ kubectl label namespace default istio-injection=enabled
|
||||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
namespace/default labeled
|
||||||
grafana ClusterIP 172.21.211.123 <none> 3000/TCP 2m
|
{{< /text >}}
|
||||||
istio-citadel ClusterIP 172.21.177.222 <none> 8060/TCP,15014/TCP 2m
|
|
||||||
istio-egressgateway ClusterIP 172.21.113.24 <none> 80/TCP,443/TCP,15443/TCP 2m
|
## 部署示例应用 {#bookinfo}
|
||||||
istio-galley ClusterIP 172.21.132.247 <none> 443/TCP,15014/TCP,9901/TCP 2m
|
|
||||||
istio-ingressgateway LoadBalancer 172.21.144.254 52.116.22.242 15020:31831/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:30318/TCP,15030:32645/TCP,15031:31933/TCP,15032:31188/TCP,15443:30838/TCP 2m
|
1. 部署 [`Bookinfo` 示例应用](/zh/docs/examples/bookinfo/):
|
||||||
istio-pilot ClusterIP 172.21.105.205 <none> 15010/TCP,15011/TCP,8080/TCP,15014/TCP 2m
|
|
||||||
istio-policy ClusterIP 172.21.14.236 <none> 9091/TCP,15004/TCP,15014/TCP 2m
|
{{< text bash >}}
|
||||||
istio-sidecar-injector ClusterIP 172.21.155.47 <none> 443/TCP,15014/TCP 2m
|
$ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo.yaml@
|
||||||
istio-telemetry ClusterIP 172.21.196.79 <none> 9091/TCP,15004/TCP,15014/TCP,42422/TCP 2m
|
service/details created
|
||||||
jaeger-agent ClusterIP None <none> 5775/UDP,6831/UDP,6832/UDP 2m
|
serviceaccount/bookinfo-details created
|
||||||
jaeger-collector ClusterIP 172.21.135.51 <none> 14267/TCP,14268/TCP 2m
|
deployment.apps/details-v1 created
|
||||||
jaeger-query ClusterIP 172.21.26.187 <none> 16686/TCP 2m
|
service/ratings created
|
||||||
kiali ClusterIP 172.21.155.201 <none> 20001/TCP 2m
|
serviceaccount/bookinfo-ratings created
|
||||||
prometheus ClusterIP 172.21.63.159 <none> 9090/TCP 2m
|
deployment.apps/ratings-v1 created
|
||||||
tracing ClusterIP 172.21.2.245 <none> 80/TCP 2m
|
service/reviews created
|
||||||
zipkin ClusterIP 172.21.182.245 <none> 9411/TCP 2m
|
serviceaccount/bookinfo-reviews created
|
||||||
|
deployment.apps/reviews-v1 created
|
||||||
|
deployment.apps/reviews-v2 created
|
||||||
|
deployment.apps/reviews-v3 created
|
||||||
|
service/productpage created
|
||||||
|
serviceaccount/bookinfo-productpage created
|
||||||
|
deployment.apps/productpage-v1 created
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
1. 应用很快会启动起来。当一个个的 Pod 准备就绪,ISTIO 边车代理将伴随他们一起部署。
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ kubectl get services
|
||||||
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
|
details ClusterIP 10.0.0.212 <none> 9080/TCP 29s
|
||||||
|
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 25m
|
||||||
|
productpage ClusterIP 10.0.0.57 <none> 9080/TCP 28s
|
||||||
|
ratings ClusterIP 10.0.0.33 <none> 9080/TCP 29s
|
||||||
|
reviews ClusterIP 10.0.0.28 <none> 9080/TCP 29s
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
和
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ kubectl get pods
|
||||||
|
NAME READY STATUS RESTARTS AGE
|
||||||
|
details-v1-558b8b4b76-2llld 2/2 Running 0 2m41s
|
||||||
|
productpage-v1-6987489c74-lpkgl 2/2 Running 0 2m40s
|
||||||
|
ratings-v1-7dc98c7588-vzftc 2/2 Running 0 2m41s
|
||||||
|
reviews-v1-7f99cc4496-gdxfn 2/2 Running 0 2m41s
|
||||||
|
reviews-v2-7d79d5bd5d-8zzqd 2/2 Running 0 2m41s
|
||||||
|
reviews-v3-7dbcdcbc56-m8dph 2/2 Running 0 2m41s
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
{{< tip >}}
|
{{< tip >}}
|
||||||
如果集群运行在一个不支持外部负载均衡器的环境中(例如:minikube),`istio-ingressgateway` 的 `EXTERNAL-IP` 将显示为 `<pending>` 状态。请使用服务的 `NodePort` 或 端口转发来访问网关。
|
重新运行前面的命令,在执行下面步骤之前,要等待并确保所有的 Pod 达到此状态: 就绪状态(READY)的值为 `2/2` 、状态(STATUS)的值为 `Running` 。
|
||||||
|
基于你平台的不同,这个操作过程可能会花费几分钟的时间。
|
||||||
{{< /tip >}}
|
{{< /tip >}}
|
||||||
|
|
||||||
请确保关联的 Kubernetes pod 已经部署,并且 `STATUS` 为 `Running`:
|
1. 验证方方面面均工作无误。运行下面命令,通过检查返回的页面标题,来验证应用是否已在集群中运行,并已提供网页服务:
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ kubectl get pods -n istio-system
|
$ kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -s productpage:9080/productpage | grep -o "<title>.*</title>"
|
||||||
NAME READY STATUS RESTARTS AGE
|
<title>Simple Bookstore App</title>
|
||||||
grafana-f8467cc6-rbjlg 1/1 Running 0 1m
|
|
||||||
istio-citadel-78df5b548f-g5cpw 1/1 Running 0 1m
|
|
||||||
istio-egressgateway-78569df5c4-zwtb5 1/1 Running 0 1m
|
|
||||||
istio-galley-74d5f764fc-q7nrk 1/1 Running 0 1m
|
|
||||||
istio-ingressgateway-7ddcfd665c-dmtqz 1/1 Running 0 1m
|
|
||||||
istio-pilot-f479bbf5c-qwr28 1/1 Running 0 1m
|
|
||||||
istio-policy-6fccc5c868-xhblv 1/1 Running 2 1m
|
|
||||||
istio-sidecar-injector-78499d85b8-x44m6 1/1 Running 0 1m
|
|
||||||
istio-telemetry-78b96c6cb6-ldm9q 1/1 Running 2 1m
|
|
||||||
istio-tracing-69b5f778b7-s2zvw 1/1 Running 0 1m
|
|
||||||
kiali-99f7467dc-6rvwp 1/1 Running 0 1m
|
|
||||||
prometheus-67cdb66cbb-9w2hm 1/1 Running 0 1m
|
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
## 后续步骤 {#next-steps}
|
## 对外开放应用程序 {#ip}
|
||||||
|
|
||||||
安装 Istio 后,就可以部署您自己的服务,或部署安装程序中系统的任意一个示例应用。
|
此时,BookInfo 应用已经部署,但还不能被外界访问。
|
||||||
|
要开放访问,你需要创建
|
||||||
|
[Istio 入站网关(Ingress Gateway)](/zh/docs/concepts/traffic-management/#gateways),
|
||||||
|
它会在网格边缘把一个路径映射到路由。
|
||||||
|
|
||||||
|
1. 把应用关联到 Istio 网关:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ kubectl apply -f @samples/bookinfo/networking/bookinfo-gateway.yaml@
|
||||||
|
gateway.networking.istio.io/bookinfo-gateway created
|
||||||
|
virtualservice.networking.istio.io/bookinfo created
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
1. 确保配置文件没有问题:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ istioctl analyze
|
||||||
|
✔ No validation issues found when analyzing namespace: default.
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
### 确定入站 IP 和端口
|
||||||
|
|
||||||
|
按照说明,为访问网关设置两个变量:`INGRESS_HOST` 和 `INGRESS_PORT`。
|
||||||
|
使用标签页,切换到你选用平台的说明:
|
||||||
|
|
||||||
|
{{< tabset category-name="gateway-ip" >}}
|
||||||
|
|
||||||
|
{{< tab name="Minikube" category-value="external-lb" >}}
|
||||||
|
|
||||||
|
设置入站端口:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
|
||||||
|
$ export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
确认端口被成功的赋值给了每一个环境变量:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ echo "$INGRESS_PORT"
|
||||||
|
32194
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ echo "$SECURE_INGRESS_PORT"
|
||||||
|
31632
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
设置入站 IP:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ export INGRESS_HOST=$(minikube ip)
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
确认 IP 地址被成功的赋值给了环境变量:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ echo "$INGRESS_HOST"
|
||||||
|
192.168.4.102
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
在一个新的终端窗口中执行此命令,启动一个 Minikube tunnel,它将把流量发送到你 Istio 入站网关:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ minikube tunnel
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
{{< /tab >}}
|
||||||
|
|
||||||
|
{{< tab name="其他平台" category-value="node-port" >}}
|
||||||
|
|
||||||
|
执行下面命令进行判断:你的 Kubernetes 集群环境是否支持外部负载均衡:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ kubectl get svc istio-ingressgateway -n istio-system
|
||||||
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
|
istio-ingressgateway LoadBalancer 172.21.109.129 130.211.10.121 80:31380/TCP,443:31390/TCP,31400:31400/TCP 17h
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
设置 `EXTERNAL-IP` 的值之后,
|
||||||
|
你的环境就有了一个外部的负载均衡,可以用它做入站网关。
|
||||||
|
但如果 `EXTERNAL-IP` 的值为 `<none>` (或者一直是 `<pending>` 状态),
|
||||||
|
则你的环境则没有提供可作为入站流量网关的外部负载均衡。
|
||||||
|
这个情况,你还可以用服务(Service)的
|
||||||
|
[节点端口](https://kubernetes.io/zh/docs/concepts/services-networking/service/#nodeport)
|
||||||
|
访问网关。
|
||||||
|
|
||||||
|
依据你的环境,选择相应的说明:
|
||||||
|
|
||||||
|
**如果你确定你的环境中确实存在外部的负载均衡,请跟随下面的说明.**
|
||||||
|
|
||||||
|
设置入站 IP 地址和端口
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||||
|
$ export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
|
||||||
|
$ export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].port}')
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
{{< warning >}}
|
{{< warning >}}
|
||||||
应用程序必须使用 HTTP/1.1 或 HTTP/2.0 协议用于 HTTP 通信;HTTP/1.0 不支持。
|
在某些环境中,负载均衡除了 IP 地址,还可以用主机名访问。
|
||||||
|
在这种情况下,入站流量网关的`EXTERNAL-IP` 值不是 IP 地址,而是一个主机名,
|
||||||
|
那上面设置 `INGRESS_HOST` 环境变量的操作会失败。
|
||||||
|
使用下面命令纠正 `INGRESS_HOST` 的值。
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
{{< /warning >}}
|
{{< /warning >}}
|
||||||
|
|
||||||
当使用 `kubectl apply` 来部署应用时,如果 pod 启动在标有 `istio-injection=enabled` 的命名空间中,那么,[Istio sidecar 注入器](/zh/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection)将自动注入 Envoy 容器到应用的 pod 中:
|
**按照下面说明:如果你的环境中没有负载均衡,那就选择一个节点端口来代替.**
|
||||||
|
|
||||||
|
设置入站的端口:
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ kubectl label namespace <namespace> istio-injection=enabled
|
$ export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
|
||||||
$ kubectl create -n <namespace> -f <your-app-spec>.yaml
|
$ export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
在没有 `istio-injection` 标记的命名空间中,在部署前可以使用 [`istioctl kube-inject`](/zh/docs/reference/commands/istioctl/#istioctl-kube-inject) 命令将 Envoy 容器手动注入到应用的 pod 中:
|
_GKE:_
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ istioctl kube-inject -f <your-app-spec>.yaml | kubectl apply -f -
|
$ export INGRESS_HOST=workerNodeAddress
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
||||||
如果您不确定要从哪开始,可以先[部署 Bookinfo 示例](/zh/docs/examples/bookinfo/),它会让您体验到 Istio 的流量路由、故障注入、速率限制等功能。
|
你需要创建一个防火墙规则,放行发往 `ingressgateway` 的 TCP 流量。
|
||||||
然后您可以根据您的兴趣浏览各种各样的 [Istio 任务](/zh/docs/tasks/)。
|
再运行下面的命令,单独放行发往 HTTP 端口或 HTTPS 端口的流量,或者都放行。
|
||||||
|
|
||||||
下列任务都是初学者开始学习的好入口:
|
{{< text bash >}}
|
||||||
|
$ gcloud compute firewall-rules create allow-gateway-http --allow "tcp:$INGRESS_PORT"
|
||||||
|
$ gcloud compute firewall-rules create allow-gateway-https --allow "tcp:$SECURE_INGRESS_PORT"
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
_IBM Cloud Kubernetes Service:_
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ ibmcloud ks workers --cluster cluster-name-or-id
|
||||||
|
$ export INGRESS_HOST=public-IP-of-one-of-the-worker-nodes
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
_Docker For Desktop:_
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ export INGRESS_HOST=127.0.0.1
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
_Other environments:_
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ export INGRESS_HOST=$(kubectl get po -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].status.hostIP}')
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
{{< /tab >}}
|
||||||
|
|
||||||
|
{{< /tabset >}}
|
||||||
|
|
||||||
|
1. 设置环境变量 `GATEWAY_URL`:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
1. 确保 IP 地址和端口均成功的赋值给了环境变量:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ echo "$GATEWAY_URL"
|
||||||
|
192.168.99.100:32194
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
### 验证外部访问 {#confirm}
|
||||||
|
|
||||||
|
用浏览器查看 Bookinfo 应用的产品页面,验证 Bookinfo 已经实现了外部访问。
|
||||||
|
|
||||||
|
1. 运行下面命令,获取 Bookinfo 应用的外部访问地址。
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ echo "http://$GATEWAY_URL/productpage"
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
1. 把上面命令的输出地址复制粘贴到浏览器并访问,确认 Bookinfo 应用的产品页面是否可以打开。
|
||||||
|
|
||||||
|
## 查看仪表板 {#dashboard}
|
||||||
|
|
||||||
|
Istio 和[几个](/zh/docs/ops/integrations)遥测应用做了集成。
|
||||||
|
遥测能帮你了解服务网格的结构、展示网络的拓扑结构、分析网格的健康状态。
|
||||||
|
|
||||||
|
使用下面说明部署 [Kiali](/zh/docs/ops/integrations/kiali/) 仪表板、
|
||||||
|
以及 [Prometheus](/zh/docs/ops/integrations/prometheus/)、
|
||||||
|
[Grafana](/zh/docs/ops/integrations/grafana)、
|
||||||
|
还有 [Jaeger](/zh/docs/ops/integrations/jaeger/)
|
||||||
|
|
||||||
|
1. 安装 [Kiali 和其他插件]({{< github_tree >}}/samples/addons),等待部署完成。
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ kubectl apply -f samples/addons
|
||||||
|
$ kubectl rollout status deployment/kiali -n istio-system
|
||||||
|
Waiting for deployment "kiali" rollout to finish: 0 of 1 updated replicas are available...
|
||||||
|
deployment "kiali" successfully rolled out
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
{{< tip >}}
|
||||||
|
如果在安装插件时出错,再运行一次命令。
|
||||||
|
有一些和时间相关的问题,再运行就能解决。
|
||||||
|
{{< /tip >}}
|
||||||
|
|
||||||
|
1. 访问 Kiali 仪表板。
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ istioctl dashboard kiali
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
1. 在左侧的导航菜单,选择 _Graph_ ,然后在 _Namespace_ 下拉列表中,选择 _default_ 。
|
||||||
|
|
||||||
|
Kiali 仪表板展示了网格的概览、以及 `Bookinfo` 示例应用的各个服务之间的关系。
|
||||||
|
它还提供过滤器来可视化流量的流动。
|
||||||
|
|
||||||
|
{{< image link="./kiali-example2.png" caption="Kiali Dashboard" >}}
|
||||||
|
|
||||||
|
## 后续步骤
|
||||||
|
|
||||||
|
恭喜你完成了评估安装!
|
||||||
|
|
||||||
|
对于新手来说,这些任务是非常好的资源,可以借助 `demo` 安装更深入评估 Istio 的特性:
|
||||||
|
|
||||||
- [请求路由](/zh/docs/tasks/traffic-management/request-routing/)
|
- [请求路由](/zh/docs/tasks/traffic-management/request-routing/)
|
||||||
- [故障注入](/zh/docs/tasks/traffic-management/fault-injection/)
|
- [错误注入](/zh/docs/tasks/traffic-management/fault-injection/)
|
||||||
- [流量转移](/zh/docs/tasks/traffic-management/traffic-shifting/)
|
- [流量切换](/zh/docs/tasks/traffic-management/traffic-shifting/)
|
||||||
- [查询指标](/zh/docs/tasks/observability/metrics/querying-metrics/)
|
- [查询指标](/zh/docs/tasks/observability/metrics/querying-metrics/)
|
||||||
- [可视化指标](/zh/docs/tasks/observability/metrics/using-istio-dashboard/)
|
- [可视化指标](/zh/docs/tasks/observability/metrics/using-istio-dashboard/)
|
||||||
- [日志收集](/zh/docs/tasks/observability/logs/collecting-logs/)
|
|
||||||
- [速率限制](/zh/docs/tasks/policy-enforcement/rate-limiting/)
|
|
||||||
- [Ingress 网关](/zh/docs/tasks/traffic-management/ingress/ingress-control/)
|
|
||||||
- [访问外部服务](/zh/docs/tasks/traffic-management/egress/egress-control/)
|
- [访问外部服务](/zh/docs/tasks/traffic-management/egress/egress-control/)
|
||||||
- [可视化您的网格](/zh/docs/tasks/observability/kiali/)
|
- [可视化网格](/zh/docs/tasks/observability/kiali/)
|
||||||
|
|
||||||
下一步,可以定制 Istio 并部署您自己的应用。在您开始自定义 Istio 来适配您的平台或者其他用途之前,请查看以下资源:
|
在你为了生产系统定制Istio之前,参阅这些资源:
|
||||||
|
|
||||||
- [部署模型](/zh/docs/ops/deployment/deployment-models/)
|
- [部署模型](/zh/docs/ops/deployment/deployment-models/)
|
||||||
- [部署最佳实践](/zh/docs/ops/best-practices/deployment/)
|
- [部署的最佳实践](/zh/docs/ops/best-practices/deployment/)
|
||||||
- [Pod 需求](/zh/docs/ops/deployment/requirements/)
|
- [Pod 的需求](/zh/docs/ops/deployment/requirements/)
|
||||||
- [常规安装说明](/zh/docs/setup/)
|
- [通用安装说明](/zh/docs/setup/)
|
||||||
|
|
||||||
使用 Istio 过程中有任何问题,请来信告知我们,并欢迎您加入我们的[社区](/zh/about/community/join/)。
|
## 加入 Istio 社区
|
||||||
|
|
||||||
## 卸载 {#uninstall}
|
我们欢迎你加入 [Istio 社区](/zh/about/community/join/),
|
||||||
|
提出问题,并给我们以反馈。
|
||||||
|
|
||||||
卸载程序将删除 RBAC 权限、`istio-system` 命名空间和所有相关资源。可以忽略那些不存在的资源的报错,因为它们可能已经被删除掉了。
|
## 卸载
|
||||||
|
|
||||||
|
删除 `Bookinfo` 示例应用和配置, 参阅
|
||||||
|
[清理 `Bookinfo`](/zh/docs/examples/bookinfo/#cleanup).
|
||||||
|
|
||||||
|
Istio 卸载程序按照层次结构逐级的从 `istio-system` 命令空间中删除 RBAC 权限和所有资源。对于不存在的资源报错,可以安全的忽略掉,毕竟他们已经被分层的删除了。
|
||||||
|
|
||||||
{{< text bash >}}
|
{{< text bash >}}
|
||||||
$ istioctl manifest generate --set profile=demo | kubectl delete -f -
|
$ kubectl delete -f @samples/addons@
|
||||||
|
$ istioctl manifest generate --set profile=demo | kubectl delete --ignore-not-found=true -f -
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
命名空间 `istio-system` 默认情况下并不会被删除。
|
||||||
|
不需要的时候,使用下面命令删掉它:
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ kubectl delete namespace istio-system
|
||||||
|
{{< /text >}}
|
||||||
|
|
||||||
|
指示 Istio 自动注入 Envoy 边车代理的标签默认也不删除。
|
||||||
|
不需要的时候,使用下面命令删掉它。
|
||||||
|
|
||||||
|
{{< text bash >}}
|
||||||
|
$ kubectl label namespace default istio-injection-
|
||||||
{{< /text >}}
|
{{< /text >}}
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 178 KiB |
Loading…
Reference in New Issue