首页
学习
活动
专区
圈层
工具
发布

《istio实战指南》第3章 安装Istio

第3章 安装Istio

  • 目前Kubernetes是Istio首推的部署平台,它的每个组件都是Kubernetes集群中的Deployment,并以Pod的形式运行。Istio在运行时的很多配置数据也依赖于平台。这种有复杂依赖关系的应用很适合使用Helm这样的管理工具进行安装,以便对各种配置项进行自定义。为节约篇幅,本书只通过Helm来安装Istio,这也是官方推荐的安装方式

下载安装包

  • 下载最新新版本安装包
代码语言:javascript
复制
curl -L https://git.io/getLatestIstio | sh -
  • Istio安装包内容

文件&文件夹

内容

bin

istioctl命令行工具

install

安装所需的YAML配置文件等

samples

示例文件和应用

Istio.VERSION

Istio的配置文件

  • 为使用方面,把Istioctl命令行工具加入到环境变量
代码语言:javascript
复制
export PATH=$PWD/bin:$PATH

安装

  • 最简单的安装方式,运行命令会在Kubernetes集群安装配置,可用于生产环境
代码语言:javascript
复制
istioctl manifest apply
  • 如果只是想体验一下Istio的功能,可以安装demo版的profile
代码语言:javascript
复制
$ istioctl manifest apply --set profile=demo
- Applying manifest for component Base...
✔ Finished applying manifest for component Base.
- Applying manifest for component Tracing...
- Applying manifest for component IngressGateway...
- Applying manifest for component Galley...
- Applying manifest for component Kiali...
- Applying manifest for component Pilot...
- Applying manifest for component Citadel...
- Applying manifest for component Prometheus...
- Applying manifest for component Policy...
- Applying manifest for component EgressGateway...
- Applying manifest for component Injector...
- Applying manifest for component Telemetry...
- Applying manifest for component Grafana...
✔ Finished applying manifest for component Tracing.
✔ Finished applying manifest for component Kiali.
✔ Finished applying manifest for component Citadel.
✔ Finished applying manifest for component Policy.
✔ Finished applying manifest for component IngressGateway.
✔ Finished applying manifest for component Galley.
✔ Finished applying manifest for component Prometheus.
✔ Finished applying manifest for component EgressGateway.
✔ Finished applying manifest for component Pilot.
✔ Finished applying manifest for component Injector.
✔ Finished applying manifest for component Telemetry.
✔ Finished applying manifest for component Grafana.

查看配置

  • 可以使用子命令dump查看文件配置内容
代码语言:javascript
复制
istioctl profile dump demo

更改选项

  • 如果对环境中某个环境不满意,可以单独进行修改,如把pilot组件的内存改成200Mi
代码语言:javascript
复制
$ istioctl manifest apply --set trafficManagement.components.pilot.k8s.resources.requests.memory=200Mi
- Applying manifest for component Base...
✔ Finished applying manifest for component Base.
- Applying manifest for component Citadel...
- Applying manifest for component IngressGateway...
- Applying manifest for component Pilot...
- Applying manifest for component Prometheus...
- Applying manifest for component Galley...
- Applying manifest for component Policy...
- Applying manifest for component Injector...
- Applying manifest for component Telemetry...
- Pruning objects for disabled component Kiali...
- Pruning objects for disabled component Tracing...
- Pruning objects for disabled component Grafana...
- Pruning objects for disabled component EgressGateway...
✔ Finished pruning objects for disabled component Kiali.
✔ Finished pruning objects for disabled component EgressGateway.
✔ Finished pruning objects for disabled component Grafana.
✔ Finished applying manifest for component Citadel.
✔ Finished applying manifest for component Prometheus.
✔ Finished applying manifest for component IngressGateway.
✔ Finished applying manifest for component Injector.
✔ Finished applying manifest for component Policy.
✔ Finished pruning objects for disabled component Tracing.
✔ Finished applying manifest for component Pilot.
✔ Finished applying manifest for component Galley.
✔ Finished applying manifest for component Telemetry.


✔ Installation complete

确认安装结果

  • 因为Istio的组件和服务很多,所以最好通过命令确认它们是否正常启动
  1. istio-egressgateway
  2. istio-galley
  3. istio-ingressgateway
  4. istio-pilot
  5. istio-policy
  6. istio-sidecar-injector
  7. istio-telemetry
  8. prometheus
  9. kiali
  10. tracing
  11. zipkin
  12. jaeger-agent
  13. jaeger-collector
  14. jaeger-query
代码语言:javascript
复制
kubectl get svc -n istio-system
  • 确保Pod都已经启动并正常运行,使用-w参数可查看状态变化情况
代码语言:javascript
复制
$ kubectl get pods -n istio-system
NAME                                      READY   STATUS    RESTARTS   AGE
grafana-6c8f45499-sflnl                   1/1     Running   0          23h
istio-citadel-767757649c-hcjqn            1/1     Running   1          23h
istio-egressgateway-5585c98cdb-6frzp      0/1     Running   0          23h
istio-galley-6d467f5567-99hff             1/1     Running   0          23h
istio-ingressgateway-77d7cc794-rd4ch      0/1     Running   0          23h
istio-pilot-58584cfd66-mjxl7              1/1     Running   0          23h
istio-policy-5dc7977678-k5r5j             1/1     Running   2          23h
istio-sidecar-injector-68d9b4bb87-z2ps4   1/1     Running   1          23h
istio-telemetry-5b8f48df4b-b4t2t          1/1     Running   2          23h
istio-tracing-78548677bc-4cn6q            1/1     Running   0          23h
kiali-fb5f485fb-7txxq                     1/1     Running   0          23h
prometheus-685585888b-stfx6               1/1     Running   0          23h

问题处理

Pilot启动失败

  • 查看一下是否由内存不够的原因而导致的。Pilot默认需要2GB内存(安装的是demo的profile就没这个问题)
  1. 如果使用的是Docker桌面版,则需要调大Docker使用内存以便Pilot能正常地启动。建议至少分配8GB内存保证集群运行的流畅性
  1. 如果内存比较小,也可以 尝试减少pilot内存用量
代码语言:javascript
复制
istioctl manifest apply --set trafficManagement.components.pilot.k8s.resources.requests.memory=200Mi

镜像获取错误

  • 安装过程中遇到ImagePullBackOff这样的信息,很可能因为国内网络环境问题无法下载镜像所导致的。可在网络上搜索对应的国内镜像地址重新下载
举报
领券