二 Istio:在Kubernetes(k8s)集群上安裝部署istio1.14( 二 )

修改配置文件使所有人都可以使用getmesh命令
[root@k8scloude1 ~]# cd .getmesh/[root@k8scloude1 .getmesh]# pwd/root/.getmesh[root@k8scloude1 .getmesh]# vim /etc/profile.d/getmesh.sh[root@k8scloude1 .getmesh]# cat /etc/profile.d/getmesh.shexport GETMESH_HOME="/root/.getmesh"export PATH="$GETMESH_HOME/bin:$PATH"#使配置文件生效[root@k8scloude1 .getmesh]# source /etc/profile.d/getmesh.sh我們可以運行 version 命令以確保 GetMesh 被成功安裝 。例如:
[root@k8scloude1 .getmesh]# getmesh versiongetmesh version: 1.1.4active istioctl: 1.14.4-tetrate-v0client version: 1.14.4-tetrate-v0control plane version: 1.14.3data plane version: 1.14.3 (2 proxies)版本命令輸出 GetMesh 的版本、活躍的 Istio CLI 的版本以及 Kubernetes 集群上安裝的 Istio 的版本 。
4.3 使用 GetMesh 安裝 IstioGetMesh 通過 Kubernetes 配置文件與活躍的 Kubernetes 集群進行通信 。
要在當前活躍的 Kubernetes 集群上安裝 Istio 的演示配置文件,我們可以像這樣使用 getmesh istioctl 命令:
[root@k8scloude1 .getmesh]# getmesh istioctl install --set profile=demo該命令將檢查集群,以確保它準備好安裝 Istio,一旦你確認,安裝程序將繼續使用選定的配置文件安裝 Istio 。
如果我們現在檢查版本,你會注意到輸出顯示控制平面和數據平面的版本 。
4.4 驗證配置config-validate 命令允許你對當前配置和任何尚未應用的 YAML 清單進行驗證 。
該命令使用外部資源調用一系列驗證,如上游 Istio 驗證、Kiali 庫和 GetMesh 自定義配置檢查 。
下面是一個命令輸出的例子,default命名空間沒有標記為 Istio 注入 。
The namespace is not enabled for Istio injection. Run 'kubectl label namespace default istio-injection=enabled' to enable it, or 'kubectl label namespace default istio-injection=disabled' to explicitly mark it as not needing injection.這段信息告訴我們:命名空間沒有啟用Istio注入,可以運行”kubectl label namespace default istio-injection=enabled“命令啟用Istio injection,或者運行'kubectl label namespace default istio-injection=disabled'命令顯式地將其標記為不需要注入 。
[root@k8scloude1 ~]# getmesh config-validate Running the config validator. This may take some time... 2021-08-02T19:20:33.873244ZinfoklogThrottling request took 1.196458809s, request: GET:https://35.185.226.9/api/v1/namespaces/istio-system/configmaps/istio[] NAMESPACENAMERESOURCE TYPEERROR CODESEVERITYMESSAGE defaultdefault NamespaceIST0102InfoThe namespace is not enabled for Istio injection. Run 'kubectl label namespace default istio-injection=enabled' to enable it, or 'kubectl label namespace default istio-injection=disabled' to explicitly mark it as not needing injection. The error codes of the found issues are prefixed by 'IST' or 'KIA'. For the detailed explanation, please refer to - https://istio.io/latest/docs/reference/config/analysis/ for 'IST' error codes - https://kiali.io/documentation/latest/validations/ for 'KIA' error codes同樣,你也可以傳入一個 YAML 文件來驗證它 , 然后再將它部署到集群 。例如:
[root@k8scloude1 ~]# getmesh config-validate my-resources.yaml4.5 管理多個 Istio CLI我們可以使用 show 命令來列出當前下載的 Istio 版本:
[root@k8scloude1 ~]# getmesh show1.14.4-tetrate-v0 (Active)如果電腦上沒有我們想使用的版本,可以使用 getmesh list 命令來列出所有可信的 Istio 版本:
[root@k8scloude1 ~]# getmesh list ISTIO VERSIONFLAVORFLAVOR VERSIONK8S VERSIONS*1.9.5tetrate01.17,1.18,1.19,1.201.9.5istio01.17,1.18,1.19,1.201.9.4tetrate01.17,1.18,1.19,1.201.9.4istio01.17,1.18,1.19,1.201.9.0tetrate01.17,1.18,1.19,1.201.9.0tetratefips11.17,1.18,1.19,1.201.9.0istio01.17,1.18,1.19,1.201.8.6tetrate01.16,1.17,1.18,1.191.8.6istio01.16,1.17,1.18,1.191.8.5tetrate01.16,1.17,1.18,1.191.8.5istio01.16,1.17,1.18,1.191.8.3tetrate01.16,1.17,1.18,1.191.8.3tetratefips11.16,1.17,1.18,1.191.8.3istio01.16,1.17,1.18,1.191.7.8tetrate01.16,1.17,1.181.7.8istio01.16,1.17,1.18要獲取一個特定的版本(比方說1.9.0 tetratefips),我們可以使用 fetch 命令:
[root@k8scloude1 ~]# getmesh fetch --version 1.9.0 --flavor tetratefips--flavor-version 1當上述命令完成后,GetMesh 將獲取的 Istio CLI 版本設置為活躍版本 。例如,運行 show 命令現在顯示 tetratefips 1.9.0 版本是活躍的:
[root@k8scloude1 ~]# getmesh show 1.9.0-tetratefips-v1 (Active) 1.9.5-tetrate-v0同樣,如果我們運行 getmesh istioctl version  , 我們會發現正在使用的 Istio CLI 的版本:
[root@k8scloude1 ~]# getmesh istioctl version client version: 1.9.0-tetratefips-v1 control plane version: 1.9.5-tetrate-v0 data plane version: 1.9.5-tetrate-v0 (2 proxies)

推薦閱讀