1、環境說明
框架 | 版本 | 功能 |
---|---|---|
Kubernetes | v1.20.6 | K8S集群 |
Istio | v1.12.1 | ServiceMesh |
2、下載 Istio
2.1 解壓並切換到 Istio 包所在目錄下
cd /opt/istio/ 方法一:curl -L https://istio.io/downloadIstio | sh - 方法二:wget https://github.com/istio/istio/releases/download/1.12.1/istio-1.12.1-linux-amd64.tar.gz cd istio-1.12.1
注意:如果下載最新版本istio報 Failed connect to raw.githubusercontent.com:443; 連接超時錯誤的話,請參見https://www.cnblogs.com/zhangmingcheng/p/13734344.html進行解決。
安裝目錄包含如下內容:
可以看到有4個目錄(bin、manifests、samples、tools)及3個文件(LICENSE、README.md、manifest.yaml),其中bin下是istioctl執行程序,manifests是istio相關的主要部署組件,manifest.yaml是當前istio版本中manifests目錄下各組件的配置和依賴描述,samples是一套istio應用樣例,用來部署測試做功能校驗的,tools是一些工具腳本。
2.2 將 istioctl 客戶端路徑增加到 path 環境變量中
vi /etc/profile export PATH=/opt/istio/istio-1.12.1/bin:$PATH source /etc/profile
2.3 開啟自動補全
cp /opt/istio/istio-1.12.1/tools/istioctl.bash $HOME/ source ~/istioctl.bash
3 、安裝 Istio
3.1 安裝 default配置(一般生產上建議安裝default配置)
生產上因為性能原因建議安裝default profile。
istioctl install
This will install the Istio default profile with ["Istio core" "Istiod" "Ingress gateways"] components into the cluster. Proceed? (y/N) y ✔ Istio core installed ✔ Istiod installed ✔ Ingress gateways installed - Pruning removed resources Removed PodDisruptionBudget:istio-system:istio-egressgateway. Removed Deployment:istio-system:istio-egressgateway. Removed Service:istio-system:istio-egressgateway. Removed ServiceAccount:istio-system:istio-egressgateway-service-account. Removed RoleBinding:istio-system:istio-egressgateway-sds. Removed Role:istio-system:istio-egressgateway-sds. ✔ Installation complete
注意: 安裝時選擇不同的profile安裝的組件與插件不一樣,查看當前版本profile列表使用istioctl profile list命令:
- default:根據 IstioOperator API 的默認設置啟動組件。 建議用於生產部署和 Multicluster Mesh 中的 Primary Cluster。您可以運行 istioctl profile dump 命令來查看默認設置。
- demo:這一配置具有適度的資源需求,旨在展示 Istio 的功能。 它適合運行 Bookinfo 應用程序和相關任務。 這是通過快速開始指導安裝的配置。此配置文件啟用了高級別的追蹤和訪問日志,因此不適合進行性能測試。
- minimal:與默認配置文件相同,但只安裝了控制平面組件。 它允許您使用 Separate Profile 配置控制平面和數據平面組件(例如 Gateway)。
- remote:配置 Multicluster Mesh 的 Remote Cluster。
- empty:不部署任何東西。可以作為自定義配置的基本配置文件。
- preview:預覽文件包含的功能都是實驗性。這是為了探索 Istio 的新功能。不確保穩定性、安全性和性能(使用風險需自負)。
標注 ✔ 的組件安裝在每個配置文件中:
default | demo | minimal | remote | empty | preview | |
---|---|---|---|---|---|---|
核心組件 | ||||||
istio-egressgateway |
✔ | |||||
istio-ingressgateway |
✔ | ✔ | ✔ | |||
istiod |
✔ | ✔ | ✔ | ✔ |
3.2 安裝demo配置(測試的建議安裝demo配置)
istioctl install --set profile=demo -y
This will install the Istio demo profile with ["Istio core" "Istiod" "Ingress gateways" "Egress ✔ Istio core installed - Processing resources for Istiod. ✔ Istiod installed ✔ Ingress gateways installed ✔ Egress gateways installed - Pruning removed resources Removed HorizontalPodAutoscaler:istio-system:istio-ingressgateway. Removed HorizontalPodAutoscaler:istio-system:istiod. ✔ Installation complete
3.3 檢查安裝狀態
kubectl get deployments.apps -n=istio-system
4、卸載istio
- 要從集群中完整卸載Istio
istioctl x uninstall --purge
- 控制平面的命名空間,刪除istio-system
kubectl delete namespace istio-system
5、Istio版本和kubernetes版本選擇關系
Istio版本支持狀態參見:https://istio.io/latest/docs/releases/supported-releases/#support-status-of-istio-releases