Install istio

安装 istio

我们可以在此处找到此插件的文档: https://aws-ia.github.io/terraform-aws-eks-blueprints/patterns/istio/

Terraform 代码还将安装 istio 示例应用程序 - 请参见 bookinfo.tf

cd ~/environment/tfekscode/istio
prepare-environment exposing/ingress

初始化 Terraform:

terraform init

规划部署:

terraform plan -out tfplan

应用部署:

terraform apply tfplan

下载 istio 的 CLI 和示例应用程序

cd ~/environment
rm -rf istio-1.20.3
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.20.3 TARGET_ARCH=x86_64 sh -

安装目录包含:

  • 在 samples/ 中的示例应用程序
  • bin/ 目录中的 istioctl 客户端二进制文件。
cd ~/environment/istio-1.20.3

将 istioctl 客户端添加到我们的路径:

export PATH=$PWD/bin:$PATH

应用程序将启动。随着每个 pod 变为就绪状态,Istio sidecar 将与之一起部署。

向外部流量开放应用程序

kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml -n sample

确保配置没有问题:

istioctl analyze -n sample

确定入口 IP 和端口

kubectl get svc istio-ingress -n istio-ingress

设置入口 IP 和端口:

export INGRESS_HOST=$(kubectl -n istio-ingress get service istio-ingress -o jsonpath='{.status.loadBalancer.ingress[0].hostname}') 
export INGRESS_PORT=$(kubectl -n istio-ingress get service istio-ingress -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-ingress get service istio-ingress -o jsonpath='{.spec.ports[?(@.name=="https")].port}')

设置 GATEWAY_URL:

export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT

验证外部访问

运行以下命令以检索 Bookinfo 应用程序的外部地址。

echo "http://$GATEWAY_URL/productpage"

将上一个命令的输出粘贴到我们的 Web 浏览器中,并确认显示了 Bookinfo 产品页面。

查看仪表板

使用以下说明部署 Kiali 仪表板,以及 Prometheus、Grafana 和 Jaeger。

kubectl apply -f samples/addons
kubectl rollout status deployment/kiali -n istio-system

访问仪表板

kubectl port-forward -n istio-system svc/kiali 8080:20001 --address 0.0.0.0

在左侧导航菜单中选择 Graph,在命名空间下拉菜单中选择 sample