Istio 安装部署

    1. sudo apt-get install -y jq
    2. ISTIO_VERSION=$(curl -L -s https://api.github.com/repos/istio/istio/releases/latest | jq -r .tag_name)
    3. cd istio-${ISTIO_VERSION}
    4. cp bin/istioctl /usr/local/bin

    初始化 Helm Tiller:

    然后使用 Helm 部署:

    1. helm install install/kubernetes/helm/istio --name istio --namespace istio-system \
    2. --set ingress.enabled=true \
    3. --set gateways.enabled=true \
    4. --set galley.enabled=true \
    5. --set mixer.enabled=true \
    6. --set prometheus.enabled=true \
    7. --set grafana.enabled=true \
    8. --set servicegraph.enabled=true \
    9. --set kiali.enabled=false

    部署完成后,可以检查 isotio-system namespace 中的服务是否正常运行:

    Istio 还支持管理非 Kubernetes 应用。此时需要在应用所在的 VM 或者物理中部署 Istio,具体步骤请参考 https://istio.io/docs/setup/kubernetes/additional-setup/mesh-expansion/。注意,在部署前需要满足以下条件

    • 待接入服务器必须能够通过 IP 接入网格中的服务端点。通常这需要 VPN 或者 VPC 的支持,或者容器网络为服务端点提供直接路由(非 NAT 或者防火墙屏蔽)。该服务器无需访问 Kubernetes 指派的集群 IP 地址。
    • Istio 控制平面服务(Pilot、Mixer、Citadel)以及 Kubernetes 的 DNS 服务器必须能够从虚拟机进行访问,通常会使用(也可以使用 NodePort)来满足这一要求,在虚拟机上运行 Istio 组件,或者使用自定义网络配置。
    1. # istioctl register servicename machine-ip portname:port
    2. $ istioctl -n onprem register mysql 1.2.3.4 3306
    3. $ istioctl -n onprem register svc1 1.2.3.4 http:7000

    等所有 Pod 启动后,可以通过 NodePort、负载均衡服务的外网 IP 或者 来访问这些服务。比如通过 kubectl proxy 方式,先启动 kubectl proxy

    通过 http://localhost:8001/api/v1/namespaces/istio-system/services/grafana:3000/proxy/ 访问 Grafana 服务

    通过 http://localhost:8001/api/v1/namespaces/istio-system/services/servicegraph:8088/proxy/ 访问 ServiceGraph 服务,展示服务之间调用关系图

    • /force/forcegraph.html As explored above, this is an interactive D3.js visualization.
    • /dotviz is a static visualization.
    • /dotgraph provides a DOT) serialization.
    • /graph provides a generic JSON serialization.

    通过 http://localhost:8001/api/v1/namespaces/istio-system/services/zipkin:9411/proxy/ 访问 Zipkin 跟踪页面

    安装 - 图3

    通过 访问 Prometheus 页面