Istio 安装文件
下载 Istio,下载内容包括安装文件、示例和 istioctl 命令行工具。
1、通过以下命令下载最新版本的 Istio:
curl -L https://istio.io/downloadIstio | sh -
2、解压并加载环境变量
cd istio-1.4.5
export PATH=$PATH:$PWD/bin
安装包:
- manifests/ 目录:安装 istio 相关的清单文件,包括 charts、profiles 等
- samples/ 目录:包含一组示例应用,覆盖多种应用场景
- bin/ 目录:包含 istioctl 的客户端文件。istioctl 命令行工具用于手动注入 Envoy sidecar 代理
-
Istio部署实践
Istio 主要提供了以下三种安装方式,用户可以根据自己的实际需要进行选择。
1、使用 Istioctl 安装:istioctl 是支持多种自定义选项的的命令行工具,用户可以灵活配置,实现 Istio 组件的定制化安装。Istio 官方推荐使用该方式进行安装部署,可用于生产环境。(本文安装方式)
2、使用 Helm 自定义安装:这种安装方式使用 Helm charts 定义 Istio 的安装选项,目前该安装方式已被弃用。
3、安装独立的 Operator:该方式使用独立的 Istio operator 来安装 istio,以声明式的方式管理安装配置,目前仍处于实验阶段,不推荐在生产环境使用。
1、使用 demo 配置文件进行安装
Istio 官方提供了针对不同场景的配置文件,这些内置的配置文件提供了对 Istio 控制平面和数据平面的定制内容。用户可以根据实际场景选择特定的配置文件,然后结合自定义选项完成定制化安装。当前提供以下几种内置配置文件包括:
- default:根据默认的安装选项启用组件,建议用于生产环境的部署。
- demo:用于展示 Istio 的基本功能,支持运行 Bookinfo 应用程序和相关任务。
- minimal:使用 Istio 的流量管理功能所需的最少组件。
- remote:用于配置多集群服务网格场景下的远程集群。
- empty:不部署任何组件,可用于自定义配置的基础文件。
- preview:包含实验性功能,用于探索 Istio 新功能,但无法保证稳定性。
[17:06:15 root@master01 istio-1.4.5]# istioctl manifest apply --set profile=demo
Detected that your cluster does not support third party JWT authentication. Falling back to less secure first party JWT. See https://istio.io/docs/ops/best-practices/security/#configure-third-party-service-account-tokens for details.
✔ Istio core installed
✔ Istiod installed
✔ Egress gateways installedkub
✔ Ingress gateways installed
✔ Installation complete
2、查看组件状态卸载istio
istioctl manifest generate --set profile=demo | kubectl delete -f -
3、开启自动注入[15:27:36 root@master01 ~]#kubectl get pod -n istio-system
NAME READY STATUS RESTARTS AGE
grafana-6c8f45499-wq9bq 1/1 Running 0 47h
istio-citadel-767757649c-4mznm 1/1 Running 0 47h
istio-egressgateway-5585c98cdb-jpxqh 1/1 Running 0 47h
istio-galley-6d467f5567-n847p 1/1 Running 0 47h
istio-ingressgateway-77d7cc794-4wnpf 1/1 Running 0 47h
istio-pilot-58584cfd66-zdt9s 1/1 Running 0 47h
istio-policy-5dc7977678-dnnzl 1/1 Running 7 47h
istio-sidecar-injector-68d9b4bb87-n59jc 1/1 Running 0 47h
istio-telemetry-5b8f48df4b-zgxnl 1/1 Running 8 47h
istio-tracing-78548677bc-g486p 1/1 Running 0 47h
kiali-fb5f485fb-wb2pp 1/1 Running 0 47h
prometheus-685585888b-nlbjb 1/1 Running 0 47h
kubectl label namespace default istio-injection=enabled
namespace/default labeled
查看组件面板
为了方便对服务网格应用进行观察和管理,Istio可以与不同的遥测组件进行集成,这些组件在服务拓扑、流量分析、问题定位等方面具有很大帮助。目前Istio提供的组件类型包括:Grafana、Jaeger、Kiali、Prometheus。下面我们以 Kiali 为例,介绍一下组件的安装和使用。
1、查看组件部署状态:
[15:27:36 root@master01 ~]#kubectl get pod -n istio-system
NAME READY STATUS RESTARTS AGE
grafana-6c8f45499-wq9bq 1/1 Running 0 47h
istio-citadel-767757649c-4mznm 1/1 Running 0 47h
istio-egressgateway-5585c98cdb-jpxqh 1/1 Running 0 47h
istio-galley-6d467f5567-n847p 1/1 Running 0 47h
istio-ingressgateway-77d7cc794-4wnpf 1/1 Running 0 47h
istio-pilot-58584cfd66-zdt9s 1/1 Running 0 47h
istio-policy-5dc7977678-dnnzl 1/1 Running 7 47h
istio-sidecar-injector-68d9b4bb87-n59jc 1/1 Running 0 47h
istio-telemetry-5b8f48df4b-zgxnl 1/1 Running 8 47h
istio-tracing-78548677bc-g486p 1/1 Running 0 47h
kiali-fb5f485fb-wb2pp 1/1 Running 0 47h
prometheus-685585888b-nlbjb
可以看到,Grafana、Jaeger、Kiali 和 Prometheus 组件都已经正常。
2、访问 Kiali 组件
吧istio-ingressgateway,改成nodeport(由于自己网络没有LB)
将kiali组件的TYPE修改成NodePort然后访问面板,地址:{主机IP}:30773
[15:30:40 root@master01 ~]#kubectl get svc -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
grafana ClusterIP 172.30.172.212 <none> 3000/TCP 47h
istio-citadel ClusterIP 172.30.44.84 <none> 8060/TCP,15014/TCP 47h
istio-egressgateway ClusterIP 172.30.112.190 <none> 80/TCP,443/TCP,15443/TCP 47h
istio-galley ClusterIP 172.30.2.75 <none> 443/TCP,15014/TCP,9901/TCP,15019/TCP 47h
istio-ingressgateway NodePort 172.30.116.203 <none> 15020:32391/TCP,80:30705/TCP,443:31272/TCP,15029:31370/TCP,15030:31826/TCP,15031:31737/TCP,15032:31380/TCP,15443:30155/TCP 47h
istio-pilot ClusterIP 172.30.97.99 <none> 15010/TCP,15011/TCP,8080/TCP,15014/TCP 47h
istio-policy ClusterIP 172.30.222.138 <none> 9091/TCP,15004/TCP,15014/TCP 47h
istio-sidecar-injector ClusterIP 172.30.120.224 <none> 443/TCP 47h
istio-telemetry ClusterIP 172.30.36.116 <none> 9091/TCP,15004/TCP,15014/TCP,42422/TCP 47h
jaeger-agent ClusterIP None <none> 5775/UDP,6831/UDP,6832/UDP 47h
jaeger-collector ClusterIP 172.30.172.18 <none> 14267/TCP,14268/TCP,14250/TCP 47h
jaeger-query ClusterIP 172.30.92.17 <none> 16686/TCP 47h
kiali NodePort 172.30.30.159 <none> 20001:30773/TCP 47h
prometheus ClusterIP 172.30.88.122 <none> 9090/TCP 47h
tracing ClusterIP 172.30.193.246 <none> 80/TCP 47h
zipkin ClusterIP 172.30.244.14 <none> 9411/TCP 47h
3、观察 Kiali 面板