什么是 Istio?
Istio 是一个开源服务网格,可以让团队更轻松地创建已部署服务的网络或服务器集群。 Istio 在网状网络中始终如一地提供多项重要服务,例如:
- 流量管理:Istio 简化了服务级别属性的配置,例如断路器、超时和重试。
- 安全性:Istio 提供了各种端点之间的底层安全通信通道。
- 策略:Istio 强制执行特定策略来动态地对服务的流量进行速率限制。 它还应用白名单、黑名单和拒绝来限制对服务的访问、标头重写和重定向。
- 可观察性:这包括全面的跟踪、监控和日志记录功能。
- 平台支持 这包括对运行在单个虚拟机上的 Kubernetes、Consul 和其他服务的支持。
- 集成和定制:这包括 ACL、日志记录、监控、配额等解决方案。
总而言之,Istio 通过让您在多云植入中交付、保护、控制和监控服务来帮助推出多云部署。 在这种安装场景中,Istio 被认为是独立于平台的,因此没有为特定操作系统提供参考点。
先决条件
在开始安装 Istio 之前,您需要使用与 Istio 兼容的 K8s 版本设置 Kubernetes 集群。 Istio 1.4 适用于 Kubernetes 版本 1.13 – 1.15。 Liquid Web 提供了多种类型的多节点服务器集群,可以根据您的需要进行调整。
如果您不确定 Kubernetes 究竟是什么,您可以在该链接中阅读更多相关信息。 容器化系统是用于运行微服务的快速、安全且轻量级的平台。 可以在本文中找到容器化的更多好处。
安装 Kubernetes 并设置服务器集群后,我们可以开始安装 Istio。
下载 Istio 并准备安装
首先,我们将下载最新版本的 Istio。
[root@host /]# curl -L https://istio.io/downloadIstio | sh -
输出应如下所示
root@host:~# curl -L https://istio.io/downloadIstio | sh -
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 107 100 107 0 0 312 0 --:--:-- --:--:-- --:--:-- 313
100 2804 100 2804 0 0 6258 0 --:--:-- --:--:-- --:--:-- 35493
Downloading istio-1.4.3 from https://github.com/istio/istio/releases/download/1.4.3/istio-1.4.3-linux.tar.gz ... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
100 614 0 614 0 0 2951 0 --:--:-- --:--:-- --:--:-- 2951
100 32.7M 100 32.7M 0 0 25.2M 0 0:00:01 0:00:01 --:--:-- 39.8M
Istio 1.4.3 Download Complete!
Istio has been successfully downloaded into the istio-1.4.3 folder on your system.
Next Steps:
See https://istio.io/docs/setup/kubernetes/install/ to add Istio to your Kubernetes cluster.
To configure the istioctl client tool for your workstation,
add the /root/istio-1.4.3/bin directory to your environment path variable with:
export PATH="$PATH:/root/istio-1.4.3/bin"
Begin the Istio pre-installation verification check by running:
istioctl verify-install
Need more information? Visit https://istio.io/docs/setup/kubernetes/install/
root@host:~#
然后,使用以下命令 cd 进入 Istio 包目录
root@host:~# cd istio-1.4.3/
您的安装目录应包含以下目录和文件。
root@host:~/istio-1.4.3# ll
total 48
drwxr-x--- 6 root root 4096 Jan 6 14:45 ./
drwx------ 10 root root 4096 Feb 11 12:56 ../
-rw-r--r-- 1 root root 11348 Jan 6 14:45 LICENSE
-rw-r--r-- 1 root root 6080 Jan 6 14:45 README.md
drwxr-x--- 2 root root 4096 Jan 6 14:45 bin/
drwxr-xr-x 6 root root 4096 Jan 6 14:45 install/
-rw-r----- 1 root root 657 Jan 6 14:45 manifest.yaml
drwxr-xr-x 19 root root 4096 Jan 6 14:45 samples/
drwxr-x--- 3 root root 4096 Jan 6 14:45 tools/
root@host:~/istio-1.4.3#
接下来,将 istioctl 客户端添加到您的路径
[root@host istio-1.4.3]# export PATH=$PWD/bin:$PATH
安装 Istio
您现在已准备好开始安装本身。 我们将使用演示配置文件演示安装过程。 首先,我们将应用演示清单
[root@host istio-1.4.3]# istioctl manifest apply --set profile=demo
此过程完成后,验证安装,并使用以下命令确保 Kubernetes 服务具有分配给集群的适当 IP 地址(jaeger-agent 服务除外)。
[root@host istio-1.4.3]# kubectl get svc -n istio-system
输出应如下所示。 (输出已重新格式化以便于查看)
[root@host kubectl get svc -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
Grafana ClusterIP 172.21.211.123 <none> 3000/TCP 2m
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
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
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
Istio-sidecar-injector ClusterIP 172.21.155.47 <none> 443/TCP,15014/TCP 2m
Istio-telemetry ClusterIP 172.21.196.79 <none> 9091/TCP,15004/TCP,15014/TCP,42422/TCP 2m
Jaeger-agent ClusterIP None <none> 5775/UDP,6831/UDP,6832/UDP 2m
Jaeger-collector ClusterIP 172.21.135.51 <none> 14267/TCP,14268/TCP 2m
Jaeger-query ClusterIP 172.21.26.187 <none> 16686/TCP 2m
Kiali ClusterIP 172.21.155.201 <none> 20001/TCP 2m
Prometheus ClusterIP 172.21.63.159 <none> 9090/TCP 2m
Tracing ClusterIP 172.21.2.245 <none> 80/TCP 2m
Zipkin lusterIP 172.21.182.245 <none> 9411/TCP
In addition to this, the following Kubernetes pods should be deployed and have a status of running:
[root@host istio-1.4.3]# kubectl get pods -n istio-system NAME READY STATUS RESTARTS AGE 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 运行 0 1m Istio-ingressgateway-7ddcfd665c-dmtqz 1/1 运行 0 1m Istio-pilot-f479bbf5c-qwr28 1/1 运行 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 运行 0 1m Prometheus-67cdb66cbb-9w2hm 1/1 运行 0 1m
如果使用演示配置文件,这将完成安装阶段。 请记住,演示配置文件不应用于性能评估。 演示配置文件的目的是简单地展示 Istio 的功能。 您现在可以部署应用程序,但请记住,应用程序必须使用 HTTP/1.1 或 HTTP/2.0,因为 Istio 不再支持 HTTP/1.0。
部署
这些命令将帮助您部署应用程序:
root@host istio-1.4.3]# kubectl label namespace <namespace> istio-injection=enabled
进而:
[root@host istio-1.4.3]# kubectl create -n <namespace> -f <your-app-spec>.yaml
卸载 Istio
要卸载 Istio,请使用以下命令。
[root@host istio-1.4.3]# istioctl manifest generate --set profile=demo | kubectl delete -f -
在卸载过程中忽略任何不存在的资源错误通常是安全的,因为资源是以分层方式删除的。 卸载过程会删除所有 RBAC 权限、与 Istio 相关的命名空间以及它下的层次结构中的所有其他资源。
结论
我们希望您喜欢使用 Istio,因为它是一项真正强大且有用的服务。 有关 Istio 的更多信息、文章和指南,请访问官方页面: istio.io/.
与专家交谈…
您对在服务器集群上运行 Istio、Kubernetes 或其他现代平台有疑问吗? 需要一个小型临时集群来查看您将如何部署应用程序?
给我们打电话 800.580.4985,或打开 聊天 或与我们联系,立即与我们知识渊博的解决方案团队或经验丰富的托管顾问交谈! Liquid Web 具有精通技术的能力,可以就如何最好地设置此类平台来部署您的应用程序提供帮助或建议!