溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Istio是什么

發(fā)布時(shí)間:2021-12-04 10:29:39 來(lái)源:億速云 閱讀:185 作者:小新 欄目:云計(jì)算

這篇文章主要介紹了Istio是什么,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

Istio是Google、IBM和Lyft聯(lián)合開(kāi)源的微服務(wù)Service Mesh框架,旨在解決大量微服務(wù)的發(fā)現(xiàn)、連接、管理、監(jiān)控以及安全等問(wèn)題。

Istio的主要特性包括:

  • HTTP、gRPC和TCP網(wǎng)絡(luò)流量的自動(dòng)負(fù)載均衡

  • 豐富的路由規(guī)則,細(xì)粒度的網(wǎng)絡(luò)流量行為控制

  • 流量加密、服務(wù)間認(rèn)證,以及強(qiáng)身份聲明

  • 全范圍(Fleet-wide)策略執(zhí)行

  • 深度遙測(cè)和報(bào)告

原理

Istio從邏輯上可以分為數(shù)據(jù)平面和控制平面:

  • 數(shù)據(jù)平面主要由一系列的智能代理(Envoy)組成,管理微服務(wù)之間的網(wǎng)絡(luò)通信

  • 控制平面負(fù)責(zé)管理和配置這些智能代理,并動(dòng)態(tài)執(zhí)行策略

Istio架構(gòu)可以如下圖所示

Istio是什么

主要由以下組件構(gòu)成

  • Envoy:Lyft開(kāi)源的高性能代理總線,支持動(dòng)態(tài)服務(wù)發(fā)現(xiàn)、負(fù)載均衡、TLS終止、HTTP/2和gPRC代理、健康檢查、性能測(cè)量等功能。Envoy以sidecar的方式部署在相關(guān)的服務(wù)的Pod中。

  • Mixer:負(fù)責(zé)訪問(wèn)控制、執(zhí)行策略并從Envoy代理中收集遙測(cè)數(shù)據(jù)。Mixer支持靈活的插件模型,方便擴(kuò)展

  • Pilot:用戶和Istio的接口,驗(yàn)證用戶提供的配置和路由策略并發(fā)送給Istio組件,管理Envoy示例的生命周期

  • Istio-Auth:提供服務(wù)間和終端用戶的認(rèn)證機(jī)制

安裝環(huán)境

  • CentOS 7.2

  • Docker 17.04.0-ce

  • Kubernetes 1.6.2

  • Istio 0.1.6

安裝

1.下載安裝包

下載地址:https://github.com/istio/istio/releases

下載Linux版本的當(dāng)前最新版安裝包

wget https://github.com/istio/istio/releases/download/0.1.6/istio-0.1.6-linux.tar.gz


2.解壓

解壓后,得到的目錄結(jié)構(gòu)如下:

[root@cz_fbsdb500_06 istio]# tree istio-0.1.6
istio-0.1.6
├── bin
│   └── istioctl
├── CONTRIBUTING.md
├── install
│   ├── kubernetes
│   │   ├── addons
│   │   │   ├── grafana.yaml
│   │   │   ├── prometheus.yaml
│   │   │   ├── servicegraph.yaml
│   │   │   └── zipkin.yaml
│   │   ├── istio-auth-with-cluster-ca.yaml
│   │   ├── istio-auth.yaml
│   │   ├── istio-rbac-alpha.yaml
│   │   ├── istio-rbac-beta.yaml
│   │   ├── istio.yaml
│   │   ├── README.md
│   │   └── templates
│   │       ├── istio-auth
│   │       │   ├── istio-cluster-ca.yaml
│   │       │   ├── istio-egress-auth.yaml
│   │       │   ├── istio-ingress-auth.yaml
│   │       │   └── istio-namespace-ca.yaml
│   │       ├── istio-egress.yaml
│   │       ├── istio-ingress.yaml
│   │       ├── istio-mixer.yaml
│   │       └── istio-pilot.yaml
│   └── README.md
├── istio.VERSION
├── LICENSE
├── README.md
└── samples
    ├── apps
    │   ├── bookinfo
    │   │   ├── bookinfo-ingress.yaml
    │   │   ├── bookinfo-v1.yaml
    │   │   ├── bookinfo.yaml
    │   │   ├── cleanup.sh
    │   │   ├── destination-ratings-test-delay.yaml
    │   │   ├── loadbalancing-policy-reviews.yaml
    │   │   ├── mixer-rule-additional-telemetry.yaml
    │   │   ├── mixer-rule-empty-rule.yaml
    │   │   ├── mixer-rule-ratings-denial.yaml
    │   │   ├── mixer-rule-ratings-ratelimit.yaml
    │   │   ├── README.md
    │   │   ├── route-rule-all-v1.yaml
    │   │   ├── route-rule-delay.yaml
    │   │   ├── route-rule-reviews-50-v3.yaml
    │   │   ├── route-rule-reviews-test-v2.yaml
    │   │   ├── route-rule-reviews-v2-v3.yaml
    │   │   └── route-rule-reviews-v3.yaml
    │   ├── httpbin
    │   │   ├── httpbin.yaml
    │   │   └── README.md
    │   └── sleep
    │       ├── README.md
    │       └── sleep.yaml
    └── README.md

11 directories, 46 files

3.安裝istioctl
./bin/istioctl拷貝到你的$PATH目錄下。

4.檢查RBAC
因?yàn)槲覀儼惭b的kuberentes版本是1.6.2默認(rèn)支持RBAC,這一步可以跳過(guò)。如果你使用的其他版本的kubernetes,請(qǐng)參考官方文檔操作。

執(zhí)行以下命令,正確的輸出是這樣的:

$ kubectl api-versions | grep rbac
rbac.authorization.k8s.io/v1alpha1
rbac.authorization.k8s.io/v1beta1

5.創(chuàng)建角色綁定

$ kubectl create -f install/kubernetes/istio-rbac-beta.yaml
clusterrole "istio-manager" created
clusterrole "istio-ca" created
clusterrole "istio-sidecar" created
clusterrolebinding "istio-manager-admin-role-binding" created
clusterrolebinding "istio-ca-role-binding" created
clusterrolebinding "istio-ingress-admin-role-binding" created
clusterrolebinding "istio-sidecar-role-binding" created

注意:官網(wǎng)的安裝包中的該文件中存在RoleBinding錯(cuò)誤,應(yīng)該是集群級(jí)別的clusterrolebinding,而release里的代碼只是普通的rolebinding,查看該Issue Istio manager cannot list of create k8s TPR when RBAC enabled #327。

6.安裝istio核心組件
用到的鏡像有:

docker.io/istio/mixer:0.1.6
docker.io/istio/pilot:0.1.6
docker.io/istio/proxy_debug:0.1.6

我們暫時(shí)不開(kāi)啟Istio Auth。
注意:本文中用到的所有yaml文件中的type: LoadBalancer去掉,使用默認(rèn)的ClusterIP,然后配置Traefik ingress,就可以在集群外部訪問(wèn)。請(qǐng)參考安裝Traefik ingress。

bash
kubectl apply -f install/kubernetes/istio.yaml

7.安裝監(jiān)控插件
用到的鏡像有:

docker.io/istio/grafana:0.1.6
quay.io/coreos/prometheus:v1.1.1
gcr.io/istio-testing/servicegraph:latest
docker.io/openzipkin/zipkin:latest

安裝插件

bash
kubectl apply -f install/kubernetes/addons/prometheus.yaml
kubectl apply -f install/kubernetes/addons/grafana.yaml
kubectl apply -f install/kubernetes/addons/servicegraph.yaml
kubectl apply -f install/kubernetes/addons/zipkin.yaml

在traefik ingress中增加以上幾個(gè)服務(wù)的配置,同時(shí)增加istio-ingress配置。

Yaml
- host: grafana.istio.io
  http:
    paths:
    - path: /
      backend:
        serviceName: grafana
        servicePort: 3000
- host: servicegraph.istio.io
  http:
    paths:
    - path: /
      backend:
        serviceName: servicegraph
        servicePort: 8088
- host: prometheus.istio.io
  http:
    paths:
    - path: /
      backend:
        serviceName: prometheus
        servicePort: 9090
- host: zipkin.istio.io
  http:
    paths:
    - path: /
      backend:
        serviceName: zipkin
        servicePort: 9411
- host: ingress.istio.io
  http:
    paths:
    - path: /
      backend:
        serviceName: istio-ingress
        servicePort: 80

測(cè)試

我們使用Istio提供的測(cè)試應(yīng)用bookinfo微服務(wù)來(lái)進(jìn)行測(cè)試。該應(yīng)用架構(gòu)圖如下:

Istio是什么

部署應(yīng)用

kubectl create -f <(istioctl kube-inject -f samples/apps/bookinfo/bookinfo.yaml)

Istio kube-inject命令會(huì)在bookinfo.yaml文件中增加Envoy sidecar信息。參考:https://istio.io/docs/referenc ... nject
在本機(jī)的/etc/hosts下增加VIP節(jié)點(diǎn)和ingress.istio.io的對(duì)應(yīng)信息。具體步驟參考:邊緣節(jié)點(diǎn)配置
在瀏覽器中訪問(wèn)http://ingress.istio.io/productpage

監(jiān)控

不斷刷新productpage頁(yè)面,將可以在以下幾個(gè)監(jiān)控中看到如下界面。
Grafana頁(yè)面
http://grafana.istio.io

Istio是什么

Prometheus頁(yè)面
http://prometheus.istio.io

Istio是什么

ServiceGraph頁(yè)面
http://servicegraph.istio.io/dotviz
可以用來(lái)查看服務(wù)間的依賴關(guān)系。
展示服務(wù)之間調(diào)用關(guān)系圖 ,訪問(wèn)http://servicegraph.istio.io/graph

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Istio是什么”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI