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

4.1 如何开始使用?第一步是下载 GetMesh CLI 。你可以在 macOS 和 Linux 平台上安装 GetMesh 。我们可以使用以下命令来下载最新版本的 GetMesh 和认证的 Istio 。
4.2 如何开始?第一步是下载 GetMesh CLI 。你可以在 macOS 和 Linux 平台上安装 GetMesh 。我们可以使用以下命令下载最新版本的 GetMesh 并认证 Istio 。
#安装getmesh[root@k8scloude1 ~]# curl -sL https://istio.tetratelabs.io/getmesh/install.sh | bashtetratelabs/getmesh info checking GitHub for latest tagtetratelabs/getmesh info found version: 1.1.4 for v1.1.4/linux/amd64tetratelabs/getmesh info installed /root/.getmesh/bin/getmeshtetratelabs/getmesh info updating user profile (/root/.bash_profile)...tetratelabs/getmesh info the following two lines are added into your profile (/root/.bash_profile):export GETMESH_HOME="$HOME/.getmesh"export PATH="$GETMESH_HOME/bin:$PATH"Finished installation. Open a new terminal to start using getmesh!修改配置文件使所有人都可以使用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

经验总结扩展阅读