關(guān)于我們
書(shū)單推薦
新書(shū)推薦
|
深入理解Istio:云原生服務(wù)網(wǎng)格進(jìn)階實(shí)戰(zhàn) 讀者對(duì)象:服務(wù)網(wǎng)格技術(shù)愛(ài)好者,云原生從業(yè)者,微服務(wù)開(kāi)發(fā)者和架構(gòu)師
本書(shū)是云原生社區(qū)多位服務(wù)網(wǎng)格技術(shù)專(zhuān)家的鼎力之作。全書(shū)共 10 章,內(nèi)容涉及 Service Mesh 概述、核心功能、架構(gòu)解析、安裝與部署、流量控制、可觀(guān)察性、安全、進(jìn)階實(shí)戰(zhàn)、故障排查、Service Mesh 生態(tài),分別從概念、實(shí)踐和生態(tài)擴(kuò)展 3 個(gè)層面為讀者系統(tǒng)介紹了 Istio 的相關(guān)知識(shí),著重介紹了 Istio 在 1.5 版本以后的重大變化,從底層深入剖析了 Istio 的各項(xiàng)核心功能。本書(shū)能為云計(jì)算領(lǐng)域的從業(yè)者,尤其是微服務(wù)領(lǐng)域的開(kāi)發(fā)者在落地 Istio 時(shí)提供理論指導(dǎo)和實(shí)際借鑒。
云原生社區(qū)服務(wù)于云原生終端用戶(hù),由宋凈超和其他幾位云原生技術(shù)意見(jiàn)領(lǐng)袖共同發(fā)起,成立于2020年5月。云原生社區(qū)的前身是ServiceMesher社區(qū),該社區(qū)成立于2018年5月,是國(guó)內(nèi)推廣服務(wù)網(wǎng)格技術(shù)的先驅(qū)陣地。云原生社區(qū)自成立以來(lái),圍繞Kubernetes、Istio、邊緣計(jì)算、Dapr等云原生相關(guān)技術(shù),與從業(yè)人員分享優(yōu)質(zhì)內(nèi)容,秉承 “共識(shí)、共治、共建、共享” 的原則,組織了多場(chǎng)豐富多彩的線(xiàn)上和線(xiàn)下活動(dòng)。要想了解更多,請(qǐng)?jiān)L問(wèn)云原生社區(qū)官方網(wǎng)站,或關(guān)注云原生社區(qū)微信公眾號(hào)Cloud Native Community。
第 1 章 Service Mesh 概述 ............................................................................................................ 1
1.1 Service Mesh 基本概念 ............................................................................................... 2 1.2 后 Kubernetes 時(shí)代的微服務(wù) ....................................................................................... 5 1.2.1 重要觀(guān)點(diǎn) ......................................................................................................... 6 1.2.2 Kubernetes 與 Service Mesh .............................................................................. 6 1.2.3 kube-proxy 組件 ............................................................................................... 8 1.2.4 Kubernetes Ingress 與 Istio Gateway .................................................................. 8 1.2.5 xDS 協(xié)議 ......................................................................................................... 9 1.2.6 Envoy ............................................................................................................ 11 1.2.7 Istio Service Mesh .......................................................................................... 12 1.3 什么是 Istio .............................................................................................................. 12 1.3.1 為什么使用 Istio ............................................................................................ 13 1.3.2 Istio 的平臺(tái)支持 ............................................................................................ 13 1.4 本章小結(jié) .................................................................................................................. 14 第 2 章 核心功能 .......................................................................................................................... 15 2.1 流量控制 .................................................................................................................. 15 2.1.1 請(qǐng)求路由和流量轉(zhuǎn)移 ..................................................................................... 16 2.1.2 彈性功能 ....................................................................................................... 17 2.1.3 調(diào)試能力 ....................................................................................................... 18 2.1.4 實(shí)現(xiàn)流量控制的自定義資源 .......................................................................... 19 2.2 安全 ......................................................................................................................... 20 2.2.1 認(rèn)證 .............................................................................................................. 20 2.2.2 授權(quán) .............................................................................................................. 21 2.3 可觀(guān)察性 .................................................................................................................. 21 2.4 本章小結(jié) .................................................................................................................. 23 第 3 章 架構(gòu)解析 .......................................................................................................................... 24 3.1 Istio 的架構(gòu)組成 ....................................................................................................... 24 3.2 Istio 的設(shè)計(jì)目標(biāo) ....................................................................................................... 25 3.3 Istio 的架構(gòu)變遷 ....................................................................................................... 26 3.4 控制平面 .................................................................................................................. 27 3.4.1 Pilot ............................................................................................................... 27 3.4.2 Citadel ........................................................................................................... 37 3.4.3 Galley ............................................................................................................ 40 3.5 數(shù)據(jù)平面 .................................................................................................................. 45 3.5.1 數(shù)據(jù)平面的概念 ............................................................................................ 45 3.5.2 Sidecar 注入及透明流量劫持 ......................................................................... 47 3.5.3 Sidecar 流量路由機(jī)制分析 ............................................................................. 57 3.5.4 Envoy ............................................................................................................ 86 3.5.5 MOSN ........................................................................................................... 93 3.6 本章小結(jié) .................................................................................................................. 98 第 4 章 安裝與部署 ...................................................................................................................... 99 4.1 安裝 ......................................................................................................................... 99 4.1.1 環(huán)境準(zhǔn)備 ....................................................................................................... 99 4.1.2 安裝 Kubernetes 集群 ................................................................................... 100 4.1.3 安裝 Istio ..................................................................................................... 100 4.2 升級(jí) ....................................................................................................................... 102 4.2.1 金絲雀升級(jí) ................................................................................................. 102 4.2.2 熱升級(jí) ......................................................................................................... 104 4.3 Bookinfo 實(shí)例 ......................................................................................................... 104 4.3.1 環(huán)境準(zhǔn)備 ..................................................................................................... 105 4.3.2 部署應(yīng)用 ..................................................................................................... 106 4.3.3 啟動(dòng)應(yīng)用服務(wù) .............................................................................................. 106 4.3.4 確定 Ingress 的 IP 地址和端口 ..................................................................... 107 4.3.5 集群外部訪(fǎng)問(wèn)應(yīng)用 ....................................................................................... 108 4.4 本章小結(jié) ................................................................................................................ 108 第 5 章 流量控制 ........................................................................................................................ 109 5.1 流量控制 CRD ........................................................................................................ 109 5.1.1 VirtualService ............................................................................................... 110 5.1.2 DestinationRule ............................................................................................ 111 5.1.3 Gateway ....................................................................................................... 112 5.1.4 ServiceEntry ................................................................................................. 114 5.1.5 Sidecar ......................................................................................................... 115 5.2 路由 ....................................................................................................................... 116 5.2.1 VirtualService ............................................................................................... 116 5.2.2 路由規(guī)則 ..................................................................................................... 118 5.2.3 DestinationRule ............................................................................................ 120 5.2.4 Gateway ....................................................................................................... 122 5.2.5 ServiceEntry ................................................................................................. 123 5.3 流量鏡像 ................................................................................................................ 127 5.3.1 流量鏡像能夠做什么 ................................................................................... 127 5.3.2 流量鏡像的實(shí)現(xiàn)原理 ................................................................................... 128 5.3.3 流量鏡像的配置 .......................................................................................... 130 5.3.4 流量鏡像實(shí)踐 .............................................................................................. 132 5.4 Ingress/Egress ......................................................................................................... 141 5.4.1 Ingress ......................................................................................................... 142 5.4.2 Egress .......................................................................................................... 158 5.5 超時(shí) ....................................................................................................................... 174 5.6 重試 ....................................................................................................................... 178 5.7 熔斷 ....................................................................................................................... 181 5.8 故障注入 ................................................................................................................ 184 5.8.1 HTTPFaultInjection.Abort ............................................................................. 185 5.8.2 HTTPFaultInjection.Delay ............................................................................. 186 5.9 本章小結(jié) ................................................................................................................ 189 第 6 章 可觀(guān)察性 ........................................................................................................................ 190 6.1 指標(biāo)監(jiān)控 ................................................................................................................ 190 6.1.1 Prometheus .................................................................................................. 191 6.1.2 Prometheus 配置解析 ................................................................................... 195 6.1.3 Prometheus-Istio 指標(biāo) ................................................................................... 200 6.2 可視化 .................................................................................................................... 202 6.2.1 Grafana ........................................................................................................ 203 6.2.2 Kiali ............................................................................................................ 221 6.3 日志 ....................................................................................................................... 235 6.3.1 傳統(tǒng)日志 ..................................................................................................... 235 6.3.2 云原生日志 ................................................................................................. 236 6.3.3 Istio 日志 ..................................................................................................... 236 6.3.4 ELK ............................................................................................................ 236 6.3.5 EFK ............................................................................................................. 250 6.4 分布式追蹤 ............................................................................................................ 264 6.4.1 Jaeger .......................................................................................................... 265 6.4.2 Zipkin .......................................................................................................... 272 6.4.3 SkyWalking .................................................................................................. 277 6.5 本章小結(jié) ................................................................................................................ 293 第 7 章 安全 ............................................................................................................................... 294 7.1 認(rèn)證 ....................................................................................................................... 294 7.1.1 對(duì)等認(rèn)證 ..................................................................................................... 296 7.1.2 請(qǐng)求認(rèn)證 ..................................................................................................... 307 7.2 授權(quán) ....................................................................................................................... 312 7.2.1 授權(quán)策略 ..................................................................................................... 313 7.2.2 全局策略 ..................................................................................................... 314 7.2.3 局部策略 ..................................................................................................... 315 7.2.4 Match label .................................................................................................. 316 7.2.5 匹配算法 ..................................................................................................... 317 7.2.6 規(guī)則詳解 ..................................................................................................... 318 7.2.7 操作實(shí)例 ..................................................................................................... 320 7.2.8 JWT 授權(quán) .................................................................................................... 325 7.3 本章小結(jié) ................................................................................................................ 337 第 8 章 進(jìn)階實(shí)戰(zhàn) ........................................................................................................................ 338 8.1 集成服務(wù)注冊(cè)中心 .................................................................................................. 338 8.1.1 Istio 服務(wù)模型 .............................................................................................. 338 8.1.2 Pilot 服務(wù)模型源碼分析 ............................................................................... 339 8.1.3 第三方服務(wù)注冊(cè)表集成 ............................................................................... 341 8.2 對(duì)接 API 網(wǎng)關(guān) ........................................................................................................ 342 8.2.1 Envoy .......................................................................................................... 343 8.2.2 預(yù)備工作 ..................................................................................................... 343 8.2.3 開(kāi)始監(jiān)聽(tīng) ..................................................................................................... 344 8.2.4 一條路由 ..................................................................................................... 346 8.2.5 一個(gè)服務(wù) ..................................................................................................... 348 8.3 分布式追蹤增強(qiáng) ..................................................................................................... 352 8.3.1 OpenTracing ................................................................................................ 352 8.3.2 OpenTracing 概念模型 ................................................................................. 352 8.3.3 OpenTracing 數(shù)據(jù)模型 ................................................................................. 353 8.3.4 跨進(jìn)程調(diào)用信息傳播 ................................................................................... 354 8.4 實(shí)現(xiàn)方法級(jí)別的調(diào)用跟蹤 ....................................................................................... 356 8.4.1 Istio 的分布式追蹤 ...................................................................................... 356 8.4.2 使用 OpenTracing 傳遞分布式跟蹤上下文 ................................................... 359 8.4.3 在 Istio 中加入方法級(jí)別的調(diào)用跟蹤 ............................................................ 360 8.5 實(shí)現(xiàn) Kafka 消息跟蹤 .............................................................................................. 363 8.5.1 eshop 實(shí)例程序結(jié)構(gòu) .................................................................................... 363 8.5.2 將 Kafka 消息處理加入調(diào)用鏈路跟蹤 .......................................................... 364 8.5.3 安裝 Kafka 集群 .......................................................................................... 365 8.5.4 部署實(shí)例應(yīng)用 .............................................................................................. 365 8.5.5 將調(diào)用跟蹤上下文從 Kafka 傳遞到 REST 服務(wù) ............................................ 367 8.6 部署模型 ................................................................................................................ 371 8.6.1 集群模型與控制平面模型 ............................................................................ 371 8.6.2 網(wǎng)絡(luò)模型 ..................................................................................................... 374 8.6.3 網(wǎng)格模型 ..................................................................................................... 374 8.6.4 身份和信任模型 .......................................................................................... 375 8.6.5 租戶(hù)模型 ..................................................................................................... 376 8.7 多集群部署與管理 .................................................................................................. 377 8.7.1 多控制平面 ................................................................................................. 377 8.7.2 單控制平面 ................................................................................................. 382 8.8 智能 DNS ............................................................................................................... 387 8.8.1 待解決問(wèn)題 ................................................................................................. 388 8.8.2 功能開(kāi)啟 ..................................................................................................... 389 8.8.3 訪(fǎng)問(wèn)外部服務(wù) .............................................................................................. 390 8.8.4 自動(dòng)地址分配 .............................................................................................. 391 8.8.5 跨集群訪(fǎng)問(wèn) ................................................................................................. 391 8.9 本章小結(jié) ................................................................................................................ 392 第 9 章 故障排查 ........................................................................................................................ 393 9.1 常見(jiàn)使用問(wèn)題 ......................................................................................................... 393 9.1.1 Service 端口命名約束 .................................................................................. 394 9.1.2 流量控制規(guī)則下發(fā)順序問(wèn)題 ........................................................................ 395 9.1.3 請(qǐng)求中斷分析 .............................................................................................. 396 9.1.4 Sidecar 和 user container 的啟動(dòng)順序 ............................................................ 399 9.1.5 Ingress Gateway 和 Service 端口聯(lián)動(dòng) ............................................................ 400 9.1.6 VirtualService 作用域 ................................................................................... 401 9.1.7 VirtualService 不支持 host fragment .............................................................. 402 9.1.8 全鏈路跟蹤并非完全透明接入 ..................................................................... 403 9.1.9 mTLS 導(dǎo)致連接中斷 .................................................................................... 404 9.2 診斷工具 ................................................................................................................ 405 9.2.1 istioctl 命令行工具安裝 ............................................................................... 406 9.2.2 使用 proxy-status 命令進(jìn)行診斷 ................................................................... 408 9.2.3 使用 proxy-config 命令進(jìn)行診斷 .................................................................. 412 9.2.4 使用 analyze 命令診斷 ................................................................................. 415 9.2.5 啟用 Galley 自動(dòng)配置分析診斷 .................................................................... 420 9.2.6 采用 describe 命令驗(yàn)證并理解網(wǎng)格配置 ....................................................... 422 9.2.7 ControlZ 自檢工具 ....................................................................................... 427 9.3 本章小結(jié) ................................................................................................................ 429 第 10 章 Service Mesh 生態(tài) ...................................................................................................... 430 10.1 開(kāi)源項(xiàng)目 .............................................................................................................. 430 10.1.1 Linkerd ..................................................................................................... 430 10.1.2 Envoy ....................................................................................................... 431 10.1.3 Istio .......................................................................................................... 431 10.1.4 Consul Connect ......................................................................................... 432 10.1.5 MOSN ...................................................................................................... 432 10.1.6 Kong Kuma ............................................................................................... 433 10.1.7 Aeraki ....................................................................................................... 433 10.2 商業(yè)化項(xiàng)目 ........................................................................................................... 434 10.2.1 AWS ......................................................................................................... 434 10.2.2 Google ...................................................................................................... 434 10.2.3 Microsoft .................................................................................................. 435 10.2.4 Red Hat ..................................................................................................... 435 10.2.5 Aspen Mesh .............................................................................................. 435 10.2.6 國(guó)內(nèi)項(xiàng)目 .................................................................................................. 436 10.3 標(biāo)準(zhǔn) ..................................................................................................................... 436 10.3.1 xDS .......................................................................................................... 437 10.3.2 SMI .......................................................................................................... 445 10.3.3 UDPA ....................................................................................................... 449 10.4 擴(kuò)展 ..................................................................................................................... 450 10.4.1 WebAssembly ............................................................................................ 451 10.4.2 Contour ..................................................................................................... 454 10.5 本章小結(jié) .............................................................................................................. 470
你還可能感興趣
我要評(píng)論
|