k8s~直接部署istio

經過kubectl能夠很方便的把istio部署到k8s裏,固然使用helm也是能夠的,但有時helm版本和istio會有衝突,因此本文主要使用kubectl來進行部署git

istio簡單的幾個概念

在Service Mesh中,咱們須要瞭解Data Plane和Control Plane兩個概念:網絡

  1. Data Plane:做用是處理網格內服務間的通訊,並完成服務發現、負載均衡、流量管理、健康檢查等功能;
  2. Control Plane:做用是管理和配置智能代理用於路由流量,同時配置Mixers來應用策略、收集指標。

Istio核心組件

  1. Envoy:Istio 使用 Envoy調解服務網格中全部服務的入站和出站流量。屬於數據平面。
  2. Mixer:負責在服務網格上執行訪問控制和使用策略,以及收集從Envoy和其餘服務自動監控到的數據。
  3. Pilot:爲 Envoy sidecar 提供服務發現功能,爲智能路由(例如 A/B 測試、金絲雀部署等)和彈性(超時、重試、熔斷器等)提供流量管理功能。屬於控制平面。
  4. Citadel:提供訪問控制和用戶身份認證功能。

Istio可視化管理組件

  1. Vistio:用於近乎實時地監控應用程序和集羣之間的網絡流量。
  2. Kiali:提供可視化服務網格拓撲、斷路器和請求率等功能。Kiali還包括 Jaeger Tracing,能夠提供開箱即用的分佈式跟蹤功能。
  3. jaeger:用於展現istio微服務調用鏈關係,以及微服務工做狀態監測。注意,在生產環境中,應使用Elasticsearch或cassandra持久化存儲jaeger數據。

下載istio安裝包

curl -L https://git.io/getLatestIstio | sh -

建立namespace

kubectl create namespace istio-system

安裝它的CRD資源

for i in install/kubernetes/helm/istio-init/files/crd*yaml; do kubectl apply -f $i; done

顯示結果

kubectl get crds | grep 'istio.io' | wc -l

部署核心組件

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

這個過程須要消耗一些時間,它會先下載鏡像,而後才能啓動容器app

[root@i-pcwovafu istio-1.5.1]# kubectl -n istio-system get pods
NAME                                      READY   STATUS              RESTARTS   AGE
grafana-7797c87688-9nwd9                  0/1     ContainerCreating   0          11m
istio-citadel-f5974cc7d-tqglf             0/1     ContainerCreating   0          11m
istio-egressgateway-5757854ddd-x6cq9      0/1     Running             0          11m
istio-galley-6799449b85-tnlpm             1/1     Running             0          11m
istio-grafana-post-install-1.5.1-h7ph2    0/1     Completed           0          11m
istio-ingressgateway-7dcf45496f-2cwcm     0/1     Running             0          11m
istio-pilot-7897f5dc-j9jzr                0/2     ContainerCreating   0          11m
istio-policy-5b579b8889-gs4j9             0/2     ContainerCreating   0          11m
istio-security-post-install-1.5.1-xlx2n   0/1     Completed           0          11m
istio-sidecar-injector-5d97f8cb99-rh22f   0/1     ContainerCreating   0          11m
istio-telemetry-d79f68d7d-cnpn2           0/2     ContainerCreating   0          11m
istio-tracing-797d4c8d48-fmrlh            1/1     Running             0          11m
kiali-74fdc898b9-d5w5z                    0/1     ImagePullBackOff    0          11m
prometheus-c8fdbd64f-fh7vs                0/1     ContainerCreating   0          11m

須要等待這些pod啓動以後,你的istio纔算啓動起來。負載均衡

istio核心組件說明

  1. grafana-* //監控數據可視化工具
  2. istio-citadel-* //證書管理
  3. istio-egressgateway-* //出口流量網關
  4. istio-galley-* //配置檢查
  5. istio-ingressgateway-* //入口流量網關
  6. istio-pilot-* //Envoy 服務發現,外部化配置
  7. istio-policy-* //Mixer 混合器策略檢查
  8. istio-sidecar-injector-* //邊車注入
  9. istio-telemetry-* //Mixer混合器指標收集
  10. kiali-* //Service Mesh可視化工具
  11. prometheus-* //監控報警

爲指定namespace注入istio的sidecar功能

# kubectl label namespace default istio-injection=enable

禁止注入istio的sidecar功能

# kubectl label namespace default istio-injection-

查看istio的sidecar的信息

kubectl get namespace -L istio-injection

今天主要先介紹到這邊,下次再講一下具體的istio的組件的使用。curl

相關文章
相關標籤/搜索