{"id":369,"date":"2023-06-04T22:31:34","date_gmt":"2023-06-04T14:31:34","guid":{"rendered":"https:\/\/www.dataz8.com\/?p=369"},"modified":"2023-06-07T23:44:21","modified_gmt":"2023-06-07T15:44:21","slug":"kubernetes%e4%b8%8eistio","status":"publish","type":"post","link":"https:\/\/www.dataz8.com\/?p=369","title":{"rendered":"Kubernetes\u4e0eIstio"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"369\" class=\"elementor elementor-369\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-14d7554b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"14d7554b\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-697f4abb\" data-id=\"697f4abb\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5cd7dcb9 elementor-widget__width-initial elementor-drop-cap-yes elementor-drop-cap-view-default elementor-widget elementor-widget-text-editor\" data-id=\"5cd7dcb9\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;drop_cap&quot;:&quot;yes&quot;}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><\/p>\n<p class=\"wp-block-paragraph\">\u5728\u65e9\u671f\uff0c\u6211\u4eec\u7684\u670d\u52a1\u662f\u5355\u4f53\u5e94\u7528\uff0c\u4e00\u4e2a\u5e94\u7528\u63d0\u4f9b\u4e86\u6240\u6709\u7684\u670d\u52a1\uff0c\u6240\u6709\u7684\u6a21\u5757\u90fd\u5305\u542b\u5728\u8fd9\u4e2a\u5e94\u7528\u91cc\u9762\uff0c\u4f46\u968f\u7740\u9700\u6c42\u7684\u589e\u591a\uff0c\u6a21\u5757\u4e5f\u8d8a\u6765\u8d8a\u591a\uff0c\u5355\u4f53\u5e94\u7528\u8d8a\u6765\u8d8a\u5e9e\u5927\uff0c\u6a21\u5757\u4e0e\u6a21\u5757\u4e4b\u95f4\u8026\u5408\u7a0b\u5ea6\u8d8a\u6765\u8d8a\u9ad8\uff0c\u8fd9\u6837\u4f1a\u6781\u6613\u53d1\u751f\u56e0\u4e3a\u6539\u53d8\u4e00\u4e2a\u7ec4\u4ef6\u800c\u5bfc\u81f4\u6574\u4e2a\u5355\u4f53\u5e94\u7528\u51fa\u73b0\u95ee\u9898\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u7136\u540e\uff0c\u53d1\u5c55\u5230\u8fd9\u4e2a\u9636\u6bb5\uff0c\u4e00\u822c\u90fd\u4f1a\u8fdb\u884c\u670d\u52a1\u62c6\u5206\uff0c\u4e5f\u5c31\u662f\u73b0\u5728\u6d41\u884c\u7684\u5fae\u670d\u52a1\u67b6\u6784\uff0c\u6bd4\u5982\u4ece\u4e1a\u52a1\u4e0a\u8fdb\u884c\u62c6\u5206\uff0c\u62c6\u5206\u4e4b\u540e\uff0c\u4e1a\u52a1\u4e0e\u4e1a\u52a1\u4e4b\u95f4\u6709\u76f8\u4e92\u8c03\u7528\u7684\u9700\u6c42\uff0c\u4ece\u539f\u5148\u7684\u5355\u4e2a\u5e94\u7528\u4e0b\u7684\u6a21\u5757\u4e0e\u6a21\u5757\u4e4b\u95f4\u7684\u76f4\u63a5\u8c03\u7528\u53d8\u6210\u670d\u52a1\u4e0e\u670d\u52a1\u4e4b\u95f4\u7684\u8c03\u7528\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u5fae\u670d\u52a1\u8981\u8003\u8651\u7684\u70b9\uff1a\u2460 \u670d\u52a1\u6ce8\u518c\u4e0e\u53d1\u73b0\uff1b\u2461 \u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Spring Cloud\u662f\u57fa\u4e8eSpring Boot\u7684\u4e00\u6574\u5957\u5b9e\u73b0\u5fae\u670d\u52a1\u7684\u6846\u67b6\uff0c\u63d0\u4f9b\u4e86\u5fae\u670d\u52a1\u5f00\u53d1\u6240\u9700\u7684\u914d\u7f6e\u7ba1\u7406\u3001\u670d\u52a1\u53d1\u73b0\u3001\u5fae\u670d\u52a1\u7f51\u5173\u3001\u667a\u80fd\u8def\u7531\u3001\u8d1f\u8f7d\u5747\u8861\u7b49\u6a21\u5757\u3002\u4f46\u4e5f\u5b58\u5728\u4e00\u5b9a\u7684\u4e0d\u8db3\uff0c\u6bd4\u5982\u5fae\u670d\u52a1\u6cbb\u7406\u5bf9\u4ee3\u7801\u4fb5\u5165\u6027\u8f83\u5f3a\u7b49\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Service Mesh(\u670d\u52a1\u7f51\u683c)\u4e3a\u5fae\u670d\u52a1\u67b6\u6784\u63d0\u4f9b\u4e86\u5168\u65b0\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u4e5f\u88ab\u79f0\u4e3a\u5fae\u670d\u52a1\u76842.0\u65f6\u4ee3\u3002Istio\u662f\u5f53\u524dService Mesh\u5f62\u6001\u4e0a\u6bd4\u8f83\u70ed\u95e8\u7684\u5b9e\u73b0\u65b9\u6848\uff0c\u80fd\u591f\u548ck8s\u6df1\u5ea6\u7ed3\u5408\uff0c\u66f4\u5feb\u901f\u3001\u66f4\u4fbf\u6377\u7684\u5b9e\u73b0\u670d\u52a1\u6cbb\u7406\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.dataz8.com\/?p=369\/#1_%E4%BB%80%E4%B9%88%E6%98%AF_Service_Mesh\" >1. \u4ec0\u4e48\u662f Service Mesh<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.dataz8.com\/?p=369\/#2_Istio\" >2. Istio<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.dataz8.com\/?p=369\/#21_%E4%BB%80%E4%B9%88%E6%98%AFIstio\" >2.1 \u4ec0\u4e48\u662fIstio<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.dataz8.com\/?p=369\/#22_Istio%E6%9E%B6%E6%9E%84\" >2.2 Istio\u67b6\u6784<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.dataz8.com\/?p=369\/#23_%E6%80%8E%E4%B9%88%E8%BF%90%E8%A1%8C\" >2.3 \u600e\u4e48\u8fd0\u884c<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.dataz8.com\/?p=369\/#3_%E7%89%9B%E5%88%80%E5%B0%8F%E8%AF%95%E9%83%A8%E7%BD%B2Istio\" >3. \u725b\u5200\u5c0f\u8bd5\u90e8\u7f72Istio<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.dataz8.com\/?p=369\/#4_%E6%B5%81%E9%87%8F%E7%AE%A1%E7%90%86\" >4. \u6d41\u91cf\u7ba1\u7406<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.dataz8.com\/?p=369\/#41_%E9%85%8D%E7%BD%AE%E8%AF%B7%E6%B1%82%E8%B7%AF%E7%94%B1\" >4.1 \u914d\u7f6e\u8bf7\u6c42\u8def\u7531<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%E4%BB%80%E4%B9%88%E6%98%AF_Service_Mesh\"><\/span>1. \u4ec0\u4e48\u662f Service Mesh<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Service Mesh\u662f\u4e00\u79cd\u8f6f\u4ef6\u67b6\u6784\uff0c\u5728\u642d\u5efa\u57fa\u7840\u670d\u52a1\u4e2d\uff0c\u5b83\u662f\u670d\u52a1\u5230\u670d\u52a1\u4e4b\u95f4\u901a\u8baf\u7684\u4e00\u79cd\u67b6\u6784\u6a21\u5f0f\uff0c\u901a\u8fc7\u4ee3\u7406\u7684\u65b9\u5f0f\uff0c\u62e6\u622a\u670d\u52a1\u4e4b\u95f4\u7684\u6d41\u91cf\u4fe1\u606f\uff0c\u8fdb\u884c\u52a0\u5de5\u5904\u7406\uff0c\u4ece\u800c\u8fbe\u5230\u7ba1\u7406\u670d\u52a1\u4e4b\u95f4\u4ea4\u4e92\u7684\u76ee\u7684\uff0c\u5b83\u4e0d\u662f\u201d\u670d\u52a1\u201c\u7f51\u683c\uff0c\u800c\u662f\u670d\u52a1\u53ef\u4ee5\u63d2\u5165\u7684\u201d\u4ee3\u7406\u201c\u7f51\u683c\uff0c\u4ece\u800c\u4ece\u5e94\u7528\u7a0b\u5e8f\u4ee3\u7801\u4e2d\u62bd\u8c61\u51fa\u7f51\u683c\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u8fd9\u91cc\u7684\u670d\u52a1\u95f4\u7684\u901a\u8baf\u5305\u62ec\u4e86\u8d1f\u8f7d\u5747\u8861\u3001\u7194\u65ad\u3001\u5b89\u5168\u3001\u8ffd\u8e2a\u3001\u89c2\u6d4b\u7b49\u529f\u80fd\uff0cService Mesh\u901a\u8fc7\u5c06\u8fd9\u4e9b\u670d\u52a1\u6cbb\u7406\u76f8\u5173\u7684\u529f\u80fd\uff0c\u72ec\u7acb\u5230\u4e00\u79cd\u4e13\u95e8\u7684\u67b6\u6784\uff0c\u4ece\u800c\u8ba9\u539f\u672c\u7684\u670d\u52a1\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u5b9e\u73b0\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u670d\u52a1\u7f51\u683c\u7531\u4e0e\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u6bcf\u4e2a\u670d\u52a1\u914d\u5bf9\u7684\u7f51\u7edc\u4ee3\u7406\u548c\u4e00\u7ec4\u4efb\u52a1\u7ba1\u7406\u8fdb\u7a0b\u7ec4\u6210\u3002\u4ee3\u7406\u79f0\u4e3a\u6570\u636e\u5e73\u9762\uff0c\u7ba1\u7406\u8fdb\u7a0b\u79f0\u4e3a\u63a7\u5236\u5e73\u9762\u3002\u6570\u636e\u5e73\u9762\u62e6\u622a\u4e0d\u540c\u670d\u52a1\u4e4b\u95f4\u7684\u8c03\u7528\u5e76\u8fdb\u884c\u5904\u7406\uff1b\u63a7\u5236\u5e73\u9762\u662f\u7f51\u683c\u7684\u5927\u8111\uff0c\u534f\u8c03\u4ee3\u7406\u7684\u884c\u4e3a\uff0c\u5e76\u4e3a\u8fd0\u7ef4\u4eba\u5458\u63d0\u4f9bAPI\u6765\u64cd\u7eb5\u548c\u89c2\u5bdf\u6574\u4e2a\u7f51\u7edc\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u670d\u52a1\u7f51\u683c\u67b6\u6784\u5982\u4e0b\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<figure><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/\u670d\u52a1\u7f51\u683c\u67b6\u6784.png\" alt=\"\" width=\"600\" height=\"408\" \/><\/figure>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>\u63a7\u5236\u5e73\u9762\uff1a<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u5728Service Mesh\u65b9\u6848\u4e2d\uff0c\u670d\u52a1\u6cbb\u7406\u89c4\u5219\u7684\u7ba1\u7406\u3001\u670d\u52a1\u6cbb\u7406\u884c\u4e3a\u3001\u5e94\u7528\u672c\u8eab\u90fd\u662f\u4e92\u76f8\u72ec\u7acb\uff0c\u8fd9\u4f7f\u5f97\u5e94\u7528\u53ef\u4ee5\u4e13\u6ce8\u4e8e\u4e1a\u52a1\uff0c\u800c\u670d\u52a1\u6cbb\u7406\u903b\u8f91\u5219\u5b8c\u5168\u53ef\u4ee5\u62bd\u79bb\u51fa\u6765\u7531\u8fd0\u7ef4\u56e2\u961f\u8fdb\u884c\u7edf\u4e00\u7ba1\u7406\u3002\u670d\u52a1\u7f51\u683c\u8fd0\u7ef4\u4eba\u5458\u53ef\u4ee5\u64cd\u63a7\u63a7\u5236\u5e73\u9762\uff0c\u4ee5\u914d\u7f6e\u670d\u52a1\u7f51\u683c\u4e2d\u7684\u6570\u636e\u5e73\u9762\u884c\u4e3a\uff0c\u6bd4\u5982\uff0c\u5c06\u6d41\u91cf\u914d\u7f6e\u4f5c\u7528\u4e8e\u63a7\u5236\u5e73\u9762\u2014\u2014\u7ffb\u8bd1\u914d\u7f6e\u5e76\u5c06\u5176\u63a8\u9001\u5230\u6570\u636e\u5e73\u9762\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>\u6570\u636e\u5e73\u9762\uff1a<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u5728Service Mesh\u65b9\u6848\u4e2d\uff0c\u6570\u636e\u5e73\u9762\u5c31\u662f\u5177\u4f53\u5b9e\u73b0\u670d\u52a1\u6cbb\u7406\u884c\u4e3a\u7684\u4ee3\u7406\u3002\u5728Istio\u4e2d\uff0c\u6570\u636e\u5e73\u9762\u7531\u8d1f\u8d23\u8def\u7531\u3001\u8d1f\u8f7d\u5747\u8861\u3001\u670d\u52a1\u53d1\u73b0\u3001\u5065\u5eb7\u68c0\u67e5\u548c\u6388\u6743\/\u8ba4\u8bc1\u7684Envoy\u4ee3\u7406\u7ec4\u6210\u3002\u8fd9\u4e9b\u4ee3\u7406\u518d\u6bcf\u4e2a\u670d\u52a1\u5b9e\u4f8b\u7684\u65c1\u8fb9\u8fd0\u884c\uff08\u5728k8s\u4e2d\uff0c\u4e0e\u5e94\u7528\u5bb9\u5668\u8fd0\u884c\u5728\u540c\u4e00\u4e2aPod\uff09\uff0c\u62e6\u622a\u6240\u6709\u4f20\u5165\u548c\u4f20\u51fa\u7684\u7528\u6237\u6d41\u91cf\uff0c\u5e76\u5728\u8fd9\u4e00\u8fc7\u7a0b\u4e2d\uff0c\u6839\u636e\u63a7\u5236\u5e73\u9762\u4e0b\u53d1\u7684\u670d\u52a1\u6cbb\u7406\u89c4\u5219\u8fdb\u884c\u6d41\u91cf\u7ba1\u7406\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>Sidecar Proxy:<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u5728Service Mesh\u65b9\u6848\u4e2d\uff0c\u7ed9\u6bcf\u4e2a\u5fae\u670d\u52a1\u5b9e\u4f8b\u90e8\u7f72\u4e00\u4e2aSidecar Proxy\u3002Sidecar\u662fService Mesh\u4e2d\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\uff0c\u5728\u8f6f\u4ef6\u7cfb\u7edf\u67b6\u6784\u4e2d\u6307\u8fb9\u8f66\u6a21\u5f0f\uff0c\u8fd9\u4e2a\u6a21\u5f0f\u5b9e\u73b0\u4e86\u6570\u636e\u5e73\u9762\uff08\u4e1a\u52a1\u903b\u8f91\uff09\u548c\u63a7\u5236\u5e73\u9762\u7684\u89e3\u8026\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u77e5\u9053kube-proxy\u6709\u4e09\u79cd\u6a21\u5f0f\uff0c\u5728v1.8\u4e4b\u524d\u4f7f\u7528\u7684\u662fiptables\u4ee5\u53causerspace\u4e24\u79cd\u6a21\u5f0f\uff0c\u5728\u4e4b\u540e\u5f15\u5165\u4e86ipvs\u6a21\u5f0f\uff0c\u5176\u4e2diptables\u548cipvs\u90fd\u662f\u5185\u6838\u6001\u4e5f\u5c31\u662f\u57fa\u4e8enetfilter\uff0c\u53ea\u6709userspace\u6a21\u5f0f\u662f\u7528\u6237\u6001\u3002\u5728k8s\u4e2d\uff0cClusterIP\u89e3\u51b3\u4e86\u670d\u52a1\u4e4b\u95f4\u76f8\u4e92\u8bbf\u95ee\u7684\u95ee\u9898\uff0c\u4f46\u5b83\u53ea\u63d0\u4f9b\u4e86\u670d\u52a1\u53d1\u73b0\u548c\u57fa\u672c\u7684LB\u529f\u80fd\uff0c\u5982\u679c\u8981\u7528\u7075\u6d3b\u7684\u8def\u7531\u89c4\u5219\u4ee5\u53caMetrics collection\u7b49\u670d\u52a1\u7ba1\u63a7\u529f\u80fd\uff0c\u5c31\u9700\u8981Istio\u7684\u670d\u52a1\u7f51\u683c\u529f\u80fd\u4e86\u3002\u5728\u90e8\u7f72Istio\u540e\uff0cIstio\u901a\u8fc7iptables\u548cSidecar Proxy\u63a5\u7ba1\u670d\u52a1\u4e4b\u95f4\u7684\u901a\u4fe1\uff0c\u670d\u52a1\u95f4\u7684\u76f8\u4e92\u901a\u4fe1\u4e0d\u518d\u901a\u8fc7kube-proxy\uff0c\u800c\u662f\u901a\u8fc7Istio\u7684Sidecar Proxy\u8fdb\u884c\u3002\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0ckube-proxy\u5de5\u4f5c\u5728\u56db\u5c42\uff0c\u800cSidecar Proxy\u5219\u662f\u4e00\u4e2a\u4e03\u5c42\u4ee3\u7406\uff0c\u53ef\u4ee5\u9488\u5bf9HTTP\u7b49\u5e94\u7528\u5c42\u7684\u8bed\u4e49\u8fdb\u884c\u5904\u7406\u548c\u8f6c\u53d1\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Istio\"><\/span>2. Istio<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istio\u89e3\u51b3\u4e86\u5f00\u53d1\u4eba\u5458\u548c\u8fd0\u8425\u5546\u5728\u5206\u5e03\u5f0f\u5fae\u670d\u52a1\u67b6\u6784\u4e2d\u9762\u4e34\u7684\u6311\u6218\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"21_%E4%BB%80%E4%B9%88%E6%98%AFIstio\"><\/span>2.1 \u4ec0\u4e48\u662fIstio<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istio\u662f\u4e00\u4e2a\u5f00\u6e90\u670d\u52a1\u7f51\u683c\uff0c\u4ed6\u900f\u660e\u7684\u5206\u5c42\u5230\u73b0\u6709\u7684\u5206\u5e03\u5f0f\u5e94\u7528\u7a0b\u5e8f\u4e0a\u3002Istio\u7684\u5f3a\u5927\u529f\u80fd\u63d0\u4f9b\u4e86\u4e00\u79cd\u7edf\u4e00\u4e14\u66f4\u6709\u6548\u7684\u65b9\u5f0f\u6765\u4fdd\u62a4\u3001\u8fde\u63a5\u548c\u76d1\u63a7\u670d\u52a1\u3002Istio\u662f\u5b9e\u73b0\u8d1f\u8f7d\u5747\u8861\u3001\u670d\u52a1\u5230\u670d\u52a1\u8eab\u4efd\u9a8c\u8bc1\u548c\u76d1\u63a7\u7684\u9014\u5f84\uff0c\u51e0\u4e4e\u4e0d\u9700\u8981\u66f4\u6539\u670d\u52a1\u4ee3\u7801\u3002\u5176\u5f3a\u5927\u7684\u63a7\u5236\u5e73\u9762\u5e26\u6765\u4e86\u91cd\u8981\u7684\u529f\u80fd\uff0c\u5305\u62ec\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<ul class=\"wp-block-list\">\n<li style=\"list-style-type: none;\">\n<ul><\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u4f7f\u7528TLS\u52a0\u5bc6\u3001\u57fa\u4e8e\u8eab\u4efd\u7684\u5f3a\u5927\u8eab\u4efd\u9a8c\u8bc1\u548c\u6388\u6743\u5728\u96c6\u7fa4\u4e2d\u4fdd\u62a4\u670d\u52a1\u5230\u670d\u52a1\u7684\u901a\u4fe1<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>HTTP\u3001gRPC\u3001WebSocket\u548cTCP\u6d41\u91cf\u7684\u81ea\u52a8\u8d1f\u8f7d\u5e73\u8861<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u901a\u8fc7\u4e30\u5bcc\u7684\u8def\u7531\u89c4\u5219\u3001\u91cd\u8bd5\u3001\u6545\u969c\u8f6c\u79fb\u548c\u6545\u969c\u6ce8\u5165\u5bf9\u6d41\u91cf\u884c\u4e3a\u8fdb\u884c\u7ec6\u7c92\u5ea6\u63a7\u5236<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u652f\u6301\u8bbf\u95ee\u63a7\u5236\u3001\u901f\u7387\u9650\u5236\u548c\u914d\u989d\u7684\u53ef\u63d2\u5165\u7b56\u7565\u5c42\u548c\u914d\u7f6eAPI<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u96c6\u7fa4\u5185\u6240\u6709\u6d41\u91cf\u7684\u81ea\u52a8\u6307\u6807\u3001\u65e5\u5fd7\u548c\u8ddf\u8e2a\uff0c\u5305\u62ec\u96c6\u7fa4\u5165\u53e3\u548c\u51fa\u53e3<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"22_Istio%E6%9E%B6%E6%9E%84\"><\/span>2.2 Istio\u67b6\u6784<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istio\u670d\u52a1\u7f51\u683c\u4ece\u903b\u8f91\u4e0a\u5206\u4e3a\u6570\u636e\u5e73\u9762\u548c\u63a7\u5236\u5e73\u9762\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<ul class=\"wp-block-list\">\n<li style=\"list-style-type: none;\">\n<ul><\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u6570\u636e\u5e73\u9762\uff1a\u7531\u4e00\u7ec4\u667a\u80fd\u4ee3\u7406\uff08Envoy\uff09\u7ec4\u6210\uff0c\u88ab\u90e8\u7f72\u4e3aSidecar\u3002\u8fd9\u4e9b\u4ee3\u7406\u8d1f\u8d23\u534f\u8c03\u548c\u63a7\u5236\u5fae\u670d\u52a1\u4e4b\u95f4\u7684\u6240\u6709\u7f51\u7edc\u901a\u4fe1\u3002\u4ed6\u4eec\u8fd8\u6536\u96c6\u548c\u62a5\u544a\u6240\u6709\u7f51\u683c\u6d41\u91cf\u7684\u9065\u6d4b\u6570\u636e\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u63a7\u5236\u5e73\u9762\uff1a\u7ba1\u7406\u5e76\u914d\u7f6e\u4ee3\u7406\u6765\u8fdb\u884c\u6d41\u91cf\u8def\u7531\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6bcf\u4e2a\u5e73\u9762\u7684\u4e0d\u540c\u7ec4\u4ef6\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<figure><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/Istio\u7ec4\u4ef6.png\" alt=\"\" width=\"648\" height=\"472\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 648px; --smush-placeholder-aspect-ratio: 648\/472;\" \/><\/figure>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6838\u5fc3\u7ec4\u4ef6\u6982\u8ff0\u5982\u4e0b\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\uff081\uff09<strong>Envoy<\/strong>\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Envoy\u662f\u4e00\u79cdL7\u4ee3\u7406\u548c\u901a\u4fe1\u603b\u7ebf\uff0c\u4e13\u4e3a\u5927\u578b\u73b0\u4ee3\u9762\u5411\u670d\u52a1\u7684\u67b6\u6784\u800c\u8bbe\u8ba1\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Envoy\u662f\u4ee5C++\u5f00\u53d1\u7684\u9ad8\u6027\u80fd\u4ee3\u7406\uff0c\u5176\u5185\u7f6e\u670d\u52a1\u53d1\u73b0\u548c\u52a8\u6001\u914d\u7f6e\u3001\u9ad8\u7ea7\u8d1f\u8f7d\u5747\u8861\u3001HTTP\/2\u3001gRPC\u3001\u5065\u5eb7\u68c0\u67e5\u3001\u524d\u7aef\/\u8fb9\u7f18\u4ee3\u7406\u652f\u6301\u7b49\u529f\u80fd\u3002Envoy\u4e3b\u8981\u9762\u5411SOA\uff08\u9762\u5411\u670d\u52a1\u7684\u67b6\u6784\uff09\u7684\u7f51\u7edc\u4ee3\u7406\uff0c\u6240\u4ee5\uff0c\u975e\u5e38\u9002\u5408\u7528\u4e8e\u5fae\u670d\u52a1\uff0c\u4e3b\u8981\u7528\u6765\u8c03\u89e3Service Mesh\u4e2d\u6240\u6709\u670d\u52a1\u7684\u5165\u7ad9\u548c\u51fa\u7ad9\u6d41\u91cf\u3002\u67b6\u6784\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<figure><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/Envoy\u67b6\u6784\u56fe.png\" alt=\"\" width=\"603\" height=\"501\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 603px; --smush-placeholder-aspect-ratio: 603\/501;\" \/><\/figure>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u67b6\u6784\u4e2d\u7684\u4e00\u4e9b\u6982\u5ff5\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<ul class=\"wp-block-list\">\n<li style=\"list-style-type: none;\">\n<ul><\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Downstream\uff1a\u4e0b\u6e38\u4e3b\u673a\uff0c\u6307\u8fde\u63a5\u5230Envoy\u7684\u4e3b\u673a\uff0c\u8fd9\u4e9b\u4e3b\u673a\u7528\u6765\u53d1\u9001\u8bf7\u6c42\u5e76\u63a5\u53d7\u54cd\u5e94\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Upstream\uff1a\u4e0a\u6e38\u4e3b\u673a\uff0c\u6307\u63a5\u6536\u6765\u81eaEnvoy\u8fde\u63a5\u548c\u8bf7\u6c42\u7684\u4e3b\u673a\uff0c\u5e76\u8fd4\u56de\u54cd\u5e94\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Listener\uff1a\u670d\u52a1\u6216\u7a0b\u5e8f\u7684\u76d1\u542c\u5668\uff0cEnvoy\u66b4\u9732\u4e00\u4e2a\u6216\u591a\u4e2a\u76d1\u542c\u4e0b\u6e38\u4e3b\u673a\u7684\u8bf7\u6c42\uff0c\u5f53\u76d1\u542c\u5230\u8bf7\u6c42\u65f6\uff0c\u901a\u8fc7Filter Chain\u628a\u5bf9\u8bf7\u6c42\u7684\u5904\u7406\u5168\u90e8\u62bd\u8c61\u4e3aFilter\uff0c\u4f8b\u5982ReadFilter\u3001WriteFilter\u3001HttpFilter\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Cluster\uff1a\u670d\u52a1\u63d0\u4f9b\u96c6\u7fa4\uff0c\u6307Envoy\u8fde\u63a5\u7684\u4e00\u7ec4\u903b\u8f91\u76f8\u540c\u7684\u4e0a\u6e38\u4e3b\u673a\u3002Envoy\u901a\u8fc7\u670d\u52a1\u53d1\u73b0\u529f\u80fd\u6765\u53d1\u73b0\u96c6\u7fa4\u5185\u7684\u6210\u5458\uff0c\u901a\u8fc7\u8d1f\u8f7d\u5747\u8861\u529f\u80fd\u5c06\u6d41\u91cf\u8def\u7531\u5230\u96c6\u7fa4\u7684\u5404\u4e2a\u6210\u5458\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>xDS\uff1axDS\u4e2d\u7684x\u662f\u4e00\u4e2a\u4ee3\u8bcd\uff0c\u7c7b\u4f3c\u4e91\u8ba1\u7b97\u7684XaaS\uff0c\u53ef\u4ee5\u6307\u4ee3IaaS\u3001PaaS\u3001SaaS\u7b49\u3002DS\u4e3aDiscovery Service\uff0c\u5373\u53d1\u73b0\u670d\u52a1\u3002xDS\u5305\u62eccds(cluster discovery service)\u3001rds(route discovery service)\u3001eds(endpoint discovery service)\u3001ads(aggregated discovery service)\uff0c\u5176\u4e2dads\u79f0\u4e3a\u805a\u5408\u7684\u53d1\u73b0\u670d\u52a1\uff0c\u662f\u5bf9cds\u3001rds\u3001lds\u3001eds\u670d\u52a1\u7684\u7edf\u4e00\u5c01\u88c5\uff0c\u89e3\u51b3cds\u3001rds\u3001lds\u3001eds\u4fe1\u606f\u66f4\u65b0\u987a\u5e8f\u4f9d\u8d56\u7684\u95ee\u9898\uff0c\u4ece\u800c\u4fdd\u8bc1\u4ee5\u4e00\u5b9a\u7684\u987a\u5e8f\u7ae5\u864e\u5404\u7c7b\u914d\u7f6e\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>endpoint\uff1a\u4e00\u4e2a\u5177\u4f53\u7684\u201d\u5e94\u7528\u5b9e\u4f8b\u201c\uff0c\u7c7b\u4f3c\u4e8ek8s\u4e2d\u7684\u4e00\u4e2aPod\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>cluster\uff1a\u53ef\u4ee5\u7406\u89e3\u201d\u5e94\u7528\u96c6\u7fa4\u201c\uff0c\u5bf9\u5e94\u63d0\u4f9b\u76f8\u540c\u670d\u52a1\u7684\u4e00\u4e2a\u6216\u591a\u4e2aendpoint\uff0c\u7c7b\u4f3ck8s\u4e2dService\u6982\u5ff5\uff0c\u5373\u4e00\u4e2aService\u63d0\u4f9b\u591a\u4e2a\u76f8\u540c\u670d\u52a1\u7684Pod\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>route\uff1a\u5f53\u505a\u91d1\u4e1d\u96c0\u53d1\u5e03\u90e8\u7f72\u65f6\uff0c\u540c\u4e00\u4e2a\u670d\u52a1\u4f1a\u6709\u591a\u4e2a\u7248\u672c\uff0c\u8fd9\u65f6\u9700\u8981route\u89c4\u5219\u89c4\u5b9a\u8bf7\u6c42\u5982\u4f55\u8def\u7531\u5230\u6211\u4e2d\u7684\u67d0\u4e2a\u7248\u672c\u4e0a\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Envoy\u6b63\u5e38\u7684\u5de5\u4f5c\u6d41\u7a0b\uff1aHost A\uff08\u4e0b\u6e38\u4e3b\u673a\uff09\u53d1\u9001\u8bf7\u6c42\u81f3\u4e0a\u6e38\u4e3b\u673a\uff08Host B\u3001Host C\u3001Host D\u7b49\uff09\uff0cEnvoy\u901a\u8fc7Listener\u76d1\u542c\u5230\u6709\u4e0b\u6e38\u4e3b\u673a\u7684\u8bf7\u6c42\uff0c\u6536\u5230\u8bf7\u6c42\u540e\u7684Envoy\u5c06\u6240\u6709\u8bf7\u6c42\u6d41\u91cf\u52ab\u6301\u81f3Envoy\u5185\u90e8\uff0c\u5e76\u5c06\u8bf7\u6c42\u5185\u5bb9\u62bd\u8c61\u4e3aFilter Chains\u8def\u7531\u81f3\u67d0\u4e2a\u4e0a\u6e38\u4e3b\u673a\u4e2d\uff0c\u4ece\u800c\u5b9e\u73b0\u8def\u7531\u8f6c\u53d1\u4ee5\u53ca\u8d1f\u8f7d\u5747\u8861\u80fd\u529b\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istio\u4f7f\u7528Envoy\u4ee3\u7406\u7684\u6269\u5c55\u7248\u672c\u3002Envoy\u4ee3\u7406\u662f\u552f\u4e00\u4e0e\u6570\u636e\u5e73\u9762\u6d41\u91cf\u4ea4\u4e92\u7684Istio\u7ec4\u4ef6\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Envoy\u4ee3\u7406\u88ab\u90e8\u7f72\u4e3a\u670d\u52a1\u7684Sidecar\uff0c\u5728\u903b\u8f91\u4e0a\u4e3a\u670d\u52a1\u589e\u52a0\u4e86Envoy\u7684\u8bb8\u591a\u5185\u7f6e\u7279\u6027\u3002\u8fd9\u79cdSidecar\u90e8\u7f72\u5141\u8bb8Istio\u53ef\u4ee5\u6267\u884c\u7b56\u7565\u51b3\u7b56\uff0c\u5e76\u63d0\u53d6\u4e30\u5bcc\u7684\u9065\u6d4b\u6570\u636e\uff0c\u63a5\u7740\u5c06\u8fd9\u4e9b\u6570\u636e\u53d1\u9001\u5230\u76d1\u89c6\u7cfb\u7edf\u4ee5\u63d0\u4f9b\u6709\u5173\u5f81\u54e5\u7f51\u683c\u884c\u4e3a\u7684\u4fe1\u606f\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u7531Envoy\u4ee3\u7406\u542f\u7528\u7684\u4e00\u4e9bIstio\u7684\u529f\u80fd\u548c\u4efb\u52a1\u5305\u62ec\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<ul class=\"wp-block-list\">\n<li style=\"list-style-type: none;\">\n<ul><\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u6d41\u91cf\u63a7\u5236\u529f\u80fd\uff1a\u901a\u8fc7\u4e30\u5bcc\u7684HTTP\u3001gRPC\u3001WebSocket\u548cTCP\u6d41\u91cf\u8def\u7531\u89c4\u5219\u6765\u6267\u884c\u7ec6\u7c92\u5ea6\u7684\u6d41\u91cf\u63a7\u5236\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u7f51\u7edc\u5f39\u6027\u7279\u6027\uff1a\u91cd\u8bd5\u8bbe\u7f6e\u3001\u6545\u969c\u8f6c\u79fb\u3001\u7194\u65ad\u5668\u548c\u6545\u969c\u6ce8\u5165\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u5b89\u5168\u6027\u548c\u8eab\u4efd\u8ba4\u8bc1\u7279\u6027\uff1a\u6267\u884c\u5b89\u5168\u6027\u7b56\u7565\uff0c\u5e76\u5f3a\u5236\u5b9e\u884c\u901a\u8fc7\u914d\u7f6eAPI\u5b9a\u4e49\u7684\u8bbf\u95ee\u63a7\u5236\u548c\u901f\u7387\u9650\u5236\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\u57fa\u4e8eWebAssembly\u7684\u53ef\u63d2\u62d4\u6269\u5c55\u6a21\u578b\uff0c\u5141\u8bb8\u901a\u8fc7\u81ea\u5b9a\u4e49\u7b56\u7565\u6267\u884c\u548c\u751f\u6210\u7f51\u683c\u6d41\u91cf\u7684\u9065\u6d4b\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\uff082\uff09<strong>Istiod\uff1a<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istiod\u63d0\u4f9b\u670d\u52a1\u53d1\u73b0\u3001\u914d\u7f6e\u548c\u8bc1\u4e66\u7ba1\u7406\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istiod\u5c06\u63a7\u5236\u6d41\u91cf\u884c\u4e3a\u7684\u9ad8\u7ea7\u8def\u7531\u89c4\u5219\u8f6c\u6362\u4e3aEnvoy\u7279\u5b9a\u7684\u914d\u7f6e\uff0c\u5e76\u5728\u8fd0\u884c\u65f6\u5c06\u5176\u4f20\u64ad\u7ed9Sidecar\u3002Pilot\u63d0\u53d6\u7279\u5b9a\u5e73\u53f0\u7684\u670d\u52a1\u53d1\u73b0\u673a\u5236\uff0c\u5e76\u5c06\u5176\u7efc\u5408\u4e3a\u4e00\u79cd\u6807\u51c6\u683c\u5f0f\uff0c\u4efb\u4f55\u7b26\u5408Envoy API\u7684Sidecar\u90fd\u53ef\u4ee5\u4f7f\u7528\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istio\u53ef\u4ee5\u652f\u6301\u53d1\u73b0\u591a\u79cd\u73af\u5883\uff0c\u5982Kubernetes\u6216VM\u3002\u53ef\u4ee5\u4f7f\u7528Istio\u6d41\u91cf\u7ba1\u7406API\u8ba9LIstiod\u91cd\u65b0\u6784\u9020Envoy\u7684\u914d\u7f6e\uff0c\u4ee5\u4fbf\u5bf9\u670d\u52a1\u7f51\u683c\u4e2d\u7684\u6d41\u91cf\u8fdb\u884c\u66f4\u7cbe\u51c6\u7684\u63a7\u5236\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istiod\u5b89\u5168\u901a\u8fc7\u5185\u7f6e\u7684\u8eab\u4efd\u548c\u51ed\u8bc1\u7ba1\u7406\uff0c\u5b9e\u73b0\u4e86\u5f3a\u5927\u7684\u670d\u52a1\u5bf9\u670d\u52a1\u548c\u7ec8\u7aef\u7528\u6237\u8ba4\u8bc1\u3002\u53ef\u4ee5\u4f7f\u7528Istio\u6765\u5347\u7ea7\u670d\u52a1\u7f51\u683c\u4e2d\u672a\u52a0\u5bc6\u7684\u6d41\u91cf\u3002\u4f7f\u7528Istio\uff0c\u8fd0\u8425\u5546\u53ef\u4ee5\u57fa\u4e8e\u670d\u52a1\u8eab\u4efd\u800c\u4e0d\u662f\u76f8\u5bf9\u4e0d\u7a33\u5b9a\u7684\u7b2c3\u5c42\u6216\u7b2c4\u5c42\u7f51\u7edc\u6807\u8bc6\u6765\u6267\u884c\u7b56\u7565\u3002\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528Istio\u7684\u6388\u6743\u529f\u80fd\u63a7\u5236\u8c01\u53ef\u4ee5\u8bbf\u95ee\u60a8\u7684\u670d\u52a1\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istiod\u5145\u5f53\u8bc1\u4e66\u6388\u6743\uff08CA\uff09\uff0c\u5e76\u751f\u6210\u8bc1\u4e66\u4ee5\u5141\u8bb8\u5728\u6570\u636e\u5e73\u9762\u4e2d\u8fdb\u884c\u5b89\u5168\u7684mTLS\u901a\u4fe1\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"23_%E6%80%8E%E4%B9%88%E8%BF%90%E8%A1%8C\"><\/span>2.3 \u600e\u4e48\u8fd0\u884c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">Istio\u7531\u4e24\u4e2a\u90e8\u5206\u7ec4\u6210\uff1a\u63a7\u5236\u5e73\u9762\u548c\u6570\u636e\u5e73\u9762\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6570\u636e\u5e73\u9762\u662f\u4e1a\u52a1\u4e4b\u95f4\u7684\u901a\u4fe1\u5e73\u9762\u3002\u5982\u679c\u6ca1\u6709\u4e00\u4e2a\u670d\u52a1\u7f51\u683c\uff0c\u7f51\u7edc\u5c31\u65e0\u6cd5\u7406\u89e3\u6b63\u5728\u4f20\u9001\u7684\u6d41\u91cf\uff0c\u4e5f\u65e0\u6cd5\u6839\u636e\u5b83\u662f\u54ea\u79cd\u7c7b\u578b\u7684\u6d41\u91cf\uff0c\u6216\u8005\u5b83\u4ece\u8c01\u90a3\u91cc\u6765\uff0c\u5230\u8c01\u90a3\u91cc\u53bb\u505a\u51fa\u4efb\u4f55\u51b3\u5b9a\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u670d\u52a1\u7f51\u683c\u4f7f\u7528\u4ee3\u7406\u62e6\u622a\u6240\u6709\u7684\u7f51\u7edc\u6d41\u91cf\uff0c\u5141\u8bb8\u6839\u636e\u8bbe\u7f6e\u7684\u914d\u7f6e\u63d0\u4f9b\u5e7f\u6cdb\u7684\u5e94\u7528\u7a0b\u5e8f\u611f\u77e5\u529f\u80fd\u3002\u4ee3\u7406\u4e0e\u96c6\u7fa4\u4e2d\u542f\u52a8\u7684\u6bcf\u4e2a\u670d\u52a1\u4e00\u8d77\u90e8\u7f72\uff0c\u6216\u8005\u4e0e\u8fd0\u884c\u5728\u865a\u62df\u673a\u4e0a\u7684\u670d\u52a1\u4e00\u8d77\u8fd0\u884c\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u63a7\u5236\u5e73\u9762\u83b7\u53d6\u6240\u9700\u7684\u914d\u7f6e\u548c\u670d\u52a1\u89c6\u56fe\uff0c\u5e76\u52a8\u6001\u7684\u5bf9\u4ee3\u7406\u670d\u52a1\u5668\u8fdb\u884c\u7f16\u7a0b\uff0c\u968f\u7740\u89c4\u5219\u6216\u73af\u5883\u7684\u53d8\u5316\u66f4\u65b0\u5b83\u4eec\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<figure><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/\u4f7f\u7528Istio\u524d.png\" alt=\"\" width=\"626\" height=\"218\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 626px; --smush-placeholder-aspect-ratio: 626\/218;\" \/><\/figure>\n<p><\/p>\n<p><\/p>\n<figure><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/\u4f7f\u7528Istio\u540e.png\" alt=\"\" width=\"664\" height=\"456\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 664px; --smush-placeholder-aspect-ratio: 664\/456;\" \/><\/figure>\n<p><\/p>\n<p><\/p>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_%E7%89%9B%E5%88%80%E5%B0%8F%E8%AF%95%E9%83%A8%E7%BD%B2Istio\"><\/span>3. \u725b\u5200\u5c0f\u8bd5\u90e8\u7f72Istio<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>\uff081\uff09\u4e0b\u8f7dIstio<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>curl -L https:\/\/istio.io\/downloadIstio | ISTIO_VERSION=1.17.2 TARGET_ARCH=x86_64 sh -<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u4e0a\u9762\u6267\u884c\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u662f\u53bb\u6267\u884cdownloadIstioCandidate.sh<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u5730\u5740\uff1ahttps:\/\/github.com\/istio\/istio\/blob\/2024024e2ba6032eac247187ec059690c782f41e\/release\/downloadIstioCandidate.sh<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master Istio]# curl -L https:\/\/istio.io\/downloadIstio | ISTIO_VERSION=1.17.2 TARGET_ARCH=x86_64 sh -\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n100   101  100   101    0     0     67      0  0:00:01  0:00:01 --:--:--    67\n100  4856  100  4856    0     0   2047      0  0:00:02  0:00:02 --:--:-- 2064k\n\nDownloading istio-1.17.2 from https:\/\/github.com\/istio\/istio\/releases\/download\/1.17.2\/istio-1.17.2-linux-amd64.tar.gz ...<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u4e0b\u8f7d\u5305\u65f6\uff0c\u6709\u65f6\u4f1a\u51fa\u73b0\u4e00\u4e9b\u60c5\u51b5\uff1a\u2460 Downloading\u65f6\u5361\u7740\u4e0d\u52a8\uff1b\u2461 curl: (35) Encountered end of file\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u53ef\u4ee5\u5728hosts\u52a0\u4e0a\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master Istio]# vim \/etc\/hosts\n185.199.110.133 raw.githubusercontent.com\n<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u5f53\u7136\uff0cgithub\u7684istio\u4e0a\u76f4\u63a5\u63d0\u4f9b\u4e86istio-1.17.2-linux-amd64.tar.gz<\/p>\n<p><\/p>\n<p><\/p>\n<figure><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/Istio-\u4e0b\u8f7d\u5305.png\" alt=\"\" width=\"758\" height=\"481\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 758px; --smush-placeholder-aspect-ratio: 758\/481;\" \/><\/figure>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4ece\u4e0a\u9762\u4e0b\u8f7d\u4e0b\u6765<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u7528curl\u4e0b\u8f7d\u6210\u529f\u540e\u5982\u4e0b\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master Istio]# curl -L https:\/\/istio.io\/downloadIstio | ISTIO_VERSION=1.17.2 TARGET_ARCH=x86_64 sh -\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n100   101  100   101    0     0     66      0  0:00:01  0:00:01 --:--:--    66\n100  4856  100  4856    0     0   2052      0  0:00:02  0:00:02 --:--:-- 4742k\n\nDownloading istio-1.17.2 from https:\/\/github.com\/istio\/istio\/releases\/download\/1.17.2\/istio-1.17.2-linux-amd64.tar.gz ...\n\nIstio 1.17.2 Download Complete!\n\nIstio has been successfully downloaded into the istio-1.17.2 folder on your system.\n\nNext Steps:\nSee https:\/\/istio.io\/latest\/docs\/setup\/install\/ to add Istio to your Kubernetes cluster.\n\nTo configure the istioctl client tool for your workstation,\nadd the \/usr\/local\/mysoft\/Istio\/istio-1.17.2\/bin directory to your environment path variable with:\n         export PATH=\"$PATH:\/usr\/local\/mysoft\/Istio\/istio-1.17.2\/bin\"\n\nBegin the Istio pre-installation check by running:\n         istioctl x precheck \n\nNeed more information? Visit https:\/\/istio.io\/latest\/docs\/setup\/install\/ <\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u8fdb\u5165istio-1.17.2\uff0c\u6709\u5982\u4e0b\u6587\u4ef6<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master Istio]# ll\ntotal 4\ndrwxr-x--- 6 root root 4096 Apr  4 05:31 istio-1.17.2\n[root@k8s-master Istio]# cd istio-1.17.2\/\n[root@k8s-master istio-1.17.2]# ll\ntotal 40\ndrwxr-x---  2 root root  4096 Apr  4 05:31 bin\n-rw-r--r--  1 root root 11348 Apr  4 05:31 LICENSE\ndrwxr-xr-x  5 root root  4096 Apr  4 05:31 manifests\n-rw-r-----  1 root root   839 Apr  4 05:31 manifest.yaml\n-rw-r--r--  1 root root  6595 Apr  4 05:31 README.md\ndrwxr-xr-x 24 root root  4096 Apr  4 05:31 samples\ndrwxr-xr-x  3 root root  4096 Apr  4 05:31 tools<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u4e0b\u8f7d\u6210\u529f\u540e\u6709\u4e2a\u63d0\u793a\uff1aexport PATH=&#8221;$PATH:\/usr\/local\/mysoft\/Istio\/istio-1.17.2\/bin&#8221;\uff0c\u6211\u8fd9\u91cc\u5c31\u628aistioctl\u901a\u8fc7cp \u62f7\u8d1d\u5230\u5176\u4ed6\u76ee\u5f55\u4e2d\u53bb<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master bin]# ll\ntotal 92720\n-rwxr-xr-x 1 root root 94941184 Apr  4 05:31 istioctl\n[root@k8s-master bin]# cp istioctl \/usr\/local\/bin\/istioctl\n[root@k8s-master bin]# istioctl version\nno running Istio pods in \"istio-system\"\n1.17.2<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u4e0a\u9762\u6709\u4e2a\u63d0\u793a\uff1ano running Istio pods in &#8220;istio-system&#8221;\uff0c\u90a3\u662f\u56e0\u4e3a\u5728k8s\u96c6\u7fa4\u4e2d\u6ca1\u6709\u540d\u4e3aistio-system\u7684namespace\uff0c\u81ea\u7136\u4e5f\u6ca1\u6709\u76f8\u5173\u7684Pod\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>\uff082\uff09\u5b89\u88c5Istio<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u672c\u6b21\u5b89\u88c5\uff0c\u6211\u4eec\u91c7\u7528demo\u914d\u7f6e\u7ec4\u5408\uff0c\u9009\u62e9\u5b83\u662f\u56e0\u4e3a\u5305\u542b\u4e86\u4e00\u7ec4\u4e13\u4e3a\u6d4b\u8bd5\u51c6\u5907\u7684\u529f\u80fd\u96c6\u5408\uff0c\u53e6\u5916\u8fd8\u6709\u7528\u4e8e\u751f\u4ea7\u6216\u6027\u80fd\u6d4b\u8bd5\u7684\u914d\u7f6e\u7ec4\u5408\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master bin]# istioctl install --set profile=demo -y\n\nThe Kubernetes version v1.22.0 is not supported by Istio 1.17.2. The minimum supported Kubernetes version is 1.23.\nProceeding with the installation, but you might experience problems. See https:\/\/istio.io\/latest\/docs\/setup\/platform-setup\/ for a list of supported versions.\n\n\u2714 Istio core installed                                                                                                                                                                                                          \n\u2714 Istiod installed                                                                                                                                                                                                              \n\u2714 Egress gateways installed                                                                                                                                                                                                     \n\u2714 Ingress gateways installed                                                                                                                                                                                                    \n\u2714 Installation complete                                                                                                                                                                                                         Making this installation the default for injection and validation.\n\nThank you for installing Istio 1.17.  Please take a few minutes to tell us about your install\/upgrade experience!  https:\/\/forms.gle\/hMHGiwZHPU7UQRWe9<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6709\u4e2a\u63d0\u793a\uff1aThe Kubernetes version v1.22.0 is not supported by Istio 1.17.2. The minimum supported Kubernetes version is 1.23.\uff0817.2\u4e0d\u652f\u6301Kubernetes v1.22.0\u7248\u672c\u3002Kubernetes\u652f\u6301\u7684\u6700\u4f4e\u7248\u672c\u662f1.23\u3002\uff09\u5230\u4e86\u8fd9\u4e00\u6b65\uff0c\u53ea\u6709\u5f80\u4e0b\u63a5\u7740\u6d4b\u8bd5\u4e86\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master Istio]# kubectl get ns\nNAME              STATUS   AGE\ndefault           Active   47d\nharbor            Active   42d\nistio-system      Active   56s<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master Istio]# kubectl get po -n istio-system\nNAME                                    READY   STATUS    RESTARTS   AGE\nistio-egressgateway-5dbb585c6-cjjzs     1\/1     Running   0          57s\nistio-ingressgateway-796c869f8b-7bxxj   1\/1     Running   0          57s\nistiod-74559ff88b-h4fq4                 1\/1     Running   0          68s<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u7ed9\u547d\u540d\u7a7a\u95f4\u6dfb\u52a0\u6807\u7b7e\uff0c\u6307\u793aIstio\u5728\u90e8\u7f72\u5e94\u7528\u7684\u65f6\u5019\uff0c\u81ea\u52a8\u6ce8\u5165Envoy\u8fb9\u8f66\u4ee3\u7406\u3002\u7ed9default\u547d\u540d\u7a7a\u95f4\u5f00\u542fSidecar\u7684\u81ea\u52a8\u6ce8\u5165\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master Istio]# kubectl label namespace default istio-injection=enabled\nnamespace\/default labeled\n[root@k8s-master Istio]# kubectl get ns --show-labels\nNAME              STATUS   AGE   LABELS\ndefault           Active   47d   istio-injection=enabled,kubernetes.io\/metadata.name=default\nharbor            Active   42d   kubernetes.io\/metadata.name=harbor\nistio-system      Active   18m   kubernetes.io\/metadata.name=istio-system\nkube-node-lease   Active   47d   kubernetes.io\/metadata.name=kube-node-lease\nkube-public       Active   47d   kubernetes.io\/metadata.name=kube-public\nkube-system       Active   47d   kubernetes.io\/metadata.name=kube-system\nmonitor-sa        Active   47d   kubernetes.io\/metadata.name=monitor-sa\nnfs               Active   42d   kubernetes.io\/metadata.name=nfs<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>\uff083\uff09\u90e8\u7f72\u793a\u4f8b\u5e94\u7528<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u2460 \u90e8\u7f72Bookinfo\u793a\u4f8b\u5e94\u7528<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master kube]# pwd\n\/usr\/local\/mysoft\/Istio\/istio-1.17.2\/samples\/bookinfo\/platform\/kube\n[root@k8s-master kube]# ll\ntotal 72\n-rw-r--r-- 1 root root  914 Apr  4 05:31 bookinfo-certificate.yaml\n-rw-r--r-- 1 root root 1387 Apr  4 05:31 bookinfo-db.yaml\n-rw-r--r-- 1 root root 1409 Apr  4 05:31 bookinfo-details-v2.yaml\n-rw-r--r-- 1 root root 1519 Apr  4 05:31 bookinfo-details.yaml\n-rw-r--r-- 1 root root 1743 Apr  4 05:31 bookinfo-ingress.yaml\n-rw-r--r-- 1 root root 2009 Apr  4 05:31 bookinfo-mysql.yaml\n-rw-r--r-- 1 root root  988 Apr  4 05:31 bookinfo-ratings-discovery.yaml\n-rw-r--r-- 1 root root 1596 Apr  4 05:31 bookinfo-ratings-v2-mysql-vm.yaml\n-rw-r--r-- 1 root root 1825 Apr  4 05:31 bookinfo-ratings-v2-mysql.yaml\n-rw-r--r-- 1 root root 1927 Apr  4 05:31 bookinfo-ratings-v2.yaml\n-rw-r--r-- 1 root root 1519 Apr  4 05:31 bookinfo-ratings.yaml\n-rw-r--r-- 1 root root 1643 Apr  4 05:31 bookinfo-reviews-v2.yaml\n-rw-r--r-- 1 root root  920 Apr  4 05:31 bookinfo-versions.yaml\n-rw-r--r-- 1 root root 7975 Apr  4 05:31 bookinfo.yaml\n-rwxr-xr-x 1 root root 2517 Apr  4 05:31 cleanup.sh\n-rw-r--r-- 1 root root 1026 Apr  4 05:31 productpage-nodeport.yaml\n-rw-r--r-- 1 root root  137 Apr  4 05:31 README.md\n[root@k8s-master kube]# kubectl apply -f bookinfo.yaml\nservice\/details created\nserviceaccount\/bookinfo-details created\ndeployment.apps\/details-v1 created\nservice\/ratings created\nserviceaccount\/bookinfo-ratings created\ndeployment.apps\/ratings-v1 created\nservice\/reviews created\nserviceaccount\/bookinfo-reviews created\ndeployment.apps\/reviews-v1 created\ndeployment.apps\/reviews-v2 created\ndeployment.apps\/reviews-v3 created\nservice\/productpage created\nserviceaccount\/bookinfo-productpage created\ndeployment.apps\/productpage-v1 created<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u2461 \u5e94\u7528\u5f88\u5feb\u542f\u52a8\u8d77\u6765\u3002\u5f53\u6bcf\u4e2aPod\u51c6\u5907\u5c31\u7eea\u65f6\uff0cIstio\u8fb9\u8f66\u5c06\u4f34\u968f\u5e94\u7528\u4e00\u8d77\u90e8\u7f72<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master kube]# kubectl get svc\nNAME          TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE\ndetails       ClusterIP   10.104.234.177   &lt;none&gt;        9080\/TCP   35s\nproductpage   ClusterIP   10.110.228.199   &lt;none&gt;        9080\/TCP   35s\nratings       ClusterIP   10.108.67.237    &lt;none&gt;        9080\/TCP   35s\nreviews       ClusterIP   10.105.19.225    &lt;none&gt;        9080\/TCP   35s\n[root@k8s-master kube]# kubectl get po\nNAME                              READY   STATUS    RESTARTS   AGE\ndetails-v1-6758dd9d8d-54kt2       2\/2     Running   0          3m45s\nproductpage-v1-797d845774-zlskb   2\/2     Running   0          3m45s\nratings-v1-f849dc6d-k8kg4         2\/2     Running   0          3m45s\nreviews-v1-74fb8fdbd8-d78xd       2\/2     Running   0          3m45s\nreviews-v2-58d564d4db-lv8gc       2\/2     Running   0          3m45s\nreviews-v3-55545c459b-j7br5       2\/2     Running   0          3m45s<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u2462 \u786e\u8ba4\u4e0a\u9762\u7684\u64cd\u4f5c\u90fd\u6b63\u786e\u540e\uff0c\u8fd0\u884c\u4e0b\u9762\u547d\u4ee4\uff0c\u901a\u8fc7\u68c0\u67e5\u8fd4\u56de\u7684\u9875\u9762\u6807\u9898\u6765\u9a8c\u8bc1\u5e94\u7528\u662f\u5426\u5df2\u5728\u96c6\u7fa4\u4e2d\u8fd0\u884c\uff0c\u5e76\u63d0\u4f9b\u7f51\u9875\u670d\u52a1<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master kube]# kubectl exec \"$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')\" -c ratings -- curl -sS productpage:9080\/productpage | grep -o \"&lt;title&gt;.*&lt;\/title&gt;\"\n&lt;title&gt;Simple Bookstore App&lt;\/title&gt;<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u7ed3\u679c\u67e5\u770b\uff0c\u5df2\u7ecf\u90e8\u7f72\u6210\u529f\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>\uff084\uff09\u5bf9\u5916\u5f00\u653e\u5e94\u7528\u7a0b\u5e8f<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6b64\u65f6\uff0cBookInfo\u5e94\u7528\u5df2\u7ecf\u90e8\u7f72\u597d\u4e86\uff0c\u4f46\u8fd8\u4e0d\u80fd\u88ab\u5916\u754c\u8bbf\u95ee\u3002\u8981\u5f00\u653e\u8bbf\u95ee\uff0c\u9700\u8981\u521b\u5efaIstio\u5165\u7ad9\u7f51\u5173\uff08Ingress Gateway\uff09,\u5b83\u4f1a\u5728\u7f51\u683c\u8fb9\u7f18\u628a\u4e00\u4e2a\u8def\u5f84\u6620\u5c04\u5230\u8def\u7531\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u2460 \u628a\u5e94\u7528\u5173\u8054\u5230Istio\u7f51\u5173<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master ~]# cd \/usr\/local\/mysoft\/Istio\/\n[root@k8s-master Istio]# ll\ntotal 4\ndrwxr-x--- 6 root root 4096 Apr  4 05:31 istio-1.17.2\n[root@k8s-master Istio]# cd istio-1.17.2\/\nbin\/       manifests\/ samples\/   tools\/     \n[root@k8s-master Istio]# cd istio-1.17.2\/samples\/bookinfo\/networking\/\n[root@k8s-master networking]# ll\ntotal 84\n-rw-r--r-- 1 root root  708 Apr  4 05:31 bookinfo-gateway.yaml\n-rw-r--r-- 1 root root  622 Apr  4 05:31 certmanager-gateway.yaml\n-rw-r--r-- 1 root root 1176 Apr  4 05:31 destination-rule-all-mtls.yaml\n-rw-r--r-- 1 root root  972 Apr  4 05:31 destination-rule-all.yaml\n-rw-r--r-- 1 root root  307 Apr  4 05:31 destination-rule-reviews.yaml\n-rw-r--r-- 1 root root  885 Apr  4 05:31 egress-rule-google-apis.yaml\n-rw-r--r-- 1 root root  522 Apr  4 05:31 fault-injection-details-v1.yaml\n-rw-r--r-- 1 root root  804 Apr  4 05:31 virtual-service-all-v1.yaml\n-rw-r--r-- 1 root root  194 Apr  4 05:31 virtual-service-details-v2.yaml\n-rw-r--r-- 1 root root  396 Apr  4 05:31 virtual-service-ratings-db.yaml\n-rw-r--r-- 1 root root  405 Apr  4 05:31 virtual-service-ratings-mysql-vm.yaml\n-rw-r--r-- 1 root root  402 Apr  4 05:31 virtual-service-ratings-mysql.yaml\n-rw-r--r-- 1 root root  423 Apr  4 05:31 virtual-service-ratings-test-abort.yaml\n-rw-r--r-- 1 root root  422 Apr  4 05:31 virtual-service-ratings-test-delay.yaml\n-rw-r--r-- 1 root root  290 Apr  4 05:31 virtual-service-reviews-50-v3.yaml\n-rw-r--r-- 1 root root  290 Apr  4 05:31 virtual-service-reviews-80-20.yaml\n-rw-r--r-- 1 root root  290 Apr  4 05:31 virtual-service-reviews-90-10.yaml\n-rw-r--r-- 1 root root  332 Apr  4 05:31 virtual-service-reviews-jason-v2-v3.yaml\n-rw-r--r-- 1 root root  334 Apr  4 05:31 virtual-service-reviews-test-v2.yaml\n-rw-r--r-- 1 root root  290 Apr  4 05:31 virtual-service-reviews-v2-v3.yaml\n-rw-r--r-- 1 root root  196 Apr  4 05:31 virtual-service-reviews-v3.yaml\n[root@k8s-master networking]# kubectl apply -f bookinfo-gateway.yaml\ngateway.networking.istio.io\/bookinfo-gateway created\nvirtualservice.networking.istio.io\/bookinfo created<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u2461 \u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u6ca1\u6709\u95ee\u9898<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master networking]# istioctl analyze\n\n\u2714 No validation issues found when analyzing namespace: default.<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>\uff085\uff09\u786e\u5b9a\u5165\u7ad9IP\u548c\u7aef\u53e3<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u6267\u884c\u4e0b\u9762\u547d\u4ee4\u5224\u65adk8s\u96c6\u7fa4\u73af\u5883\u662f\u5426\u652f\u6301\u5916\u90e8\u8d1f\u8f7d\u5747\u8861\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master networking]# kubectl get svc istio-ingressgateway -n istio-system<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u8bbe\u7f6e EXTERNAL-IP\u7684\u503c\u540e\uff0c\u73af\u5883\u5c31\u6709\u4e86\u4e00\u4e2a\u5916\u90e8\u7684\u8d1f\u8f7d\u5747\u8861\u5668\uff0c\u53ef\u4ee5\u5c06\u5176\u7528\u4f5c\u5165\u7ad9\u7f51\u5173\u3002\u4f46\u5982\u679cEXTERNAL-IP\u7684\u503c\u4e3a&lt;none&gt;(\u6216\u8005\u4e00\u76f4\u5904\u4e8e&lt;pending&gt;\u72b6\u6001)\uff0c\u5219\u73af\u5883\u6ca1\u6709\u63d0\u4f9b\u53ef\u4f5c\u4e3a\u5165\u7ad9\u6d41\u91cf\u7f51\u5173\u7684\u5916\u90e8\u8d1f\u8f7d\u5747\u8861\u5668\uff0c\u8fd9\u4e2a\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u670d\u52a1\uff08Service\uff09\u7684\u8282\u70b9\u7aef\u53e3\u8bbf\u95ee\u7f51\u5173\u3002<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u8bbe\u7f6e\u5165\u7ad9\u7684\u7aef\u53e3\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<pre><code>[root@k8s-master networking]# export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name==\"http2\")].nodePort}')\n[root@k8s-master networking]# echo $INGRESS_PORT<\/code><\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><strong>\uff086\uff09\u9a8c\u8bc1\u5916\u90e8\u8bbf\u95ee<\/strong><\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">\u7528\u6d4f\u89c8\u5668\u67e5\u770bBookInfo\u5e94\u7528\u7684\u4ea7\u54c1\u9875\u9762\uff0c\u9a8c\u8bc1BookInfo\u662f\u5426\u5b9e\u73b0\u4e86\u5916\u90e8\u8bbf\u95ee\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<figure><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/istio-productpage.png\" alt=\"\" width=\"786\" height=\"451\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 786px; --smush-placeholder-aspect-ratio: 786\/451;\" \/><\/figure>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/istio-productpage-1.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 2046px; --smush-placeholder-aspect-ratio: 2046\/1256;\" \/><\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/istio-productpage-2.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 2052px; --smush-placeholder-aspect-ratio: 2052\/1246;\" \/><\/p>\n<p>\u00a0<\/p>\n<p>\u7ecf\u9a8c\u8bc1\uff0cBookInfo\u5b9e\u73b0\u4e86\u5916\u90e8\u8bbf\u95ee\u3002<\/p>\n<p><strong>\uff087\uff09\u67e5\u770b\u4eea\u8868\u677f<\/strong><\/p>\n<p>Istio\u548c\u51e0\u4e2a\u9065\u6d4b\u5e94\u7528\u505a\u4e86\u96c6\u6210\u3002\u9065\u6d4b\u80fd\u5e2e\u52a9\u4e86\u89e3\u670d\u52a1\u7f51\u683c\u7684\u7ed3\u6784\u3001\u5c55\u793a\u7f51\u7edc\u7684\u62d3\u6251\u7ed3\u6784\u3001\u5206\u6790\u7f51\u683c\u7684\u5065\u5eb7\u72b6\u6001\u3002<\/p>\n<p>\u73b0\u5728\u6765\u90e8\u7f72Kiali\u4eea\u8868\u677f\u3001Prometheus\u3001Grafana\u4ee5\u53caJaeger\u3002<\/p>\n<p>\u2460 \u5b89\u88c5Kiali\u548c\u5176\u4ed6\u63d2\u4ef6\uff0c\u7b49\u5f85\u90e8\u7f72\u5b8c\u6210\u3002<\/p>\n<pre>[root@k8s-master istio-1.17.2]# kubectl apply -f samples\/addons<br \/>serviceaccount\/grafana created<br \/>configmap\/grafana created<br \/>service\/grafana created<br \/>deployment.apps\/grafana created<br \/>configmap\/istio-grafana-dashboards created<br \/>configmap\/istio-services-grafana-dashboards created<br \/>deployment.apps\/jaeger created<br \/>service\/tracing created<br \/>service\/zipkin created<br \/>service\/jaeger-collector created<br \/>serviceaccount\/kiali created<br \/>configmap\/kiali created<br \/>clusterrole.rbac.authorization.k8s.io\/kiali-viewer created<br \/>clusterrole.rbac.authorization.k8s.io\/kiali created<br \/>clusterrolebinding.rbac.authorization.k8s.io\/kiali created<br \/>role.rbac.authorization.k8s.io\/kiali-controlplane created<br \/>rolebinding.rbac.authorization.k8s.io\/kiali-controlplane created<br \/>service\/kiali created<br \/>deployment.apps\/kiali created<br \/>serviceaccount\/prometheus created<br \/>configmap\/prometheus created<br \/>clusterrole.rbac.authorization.k8s.io\/prometheus created<br \/>clusterrolebinding.rbac.authorization.k8s.io\/prometheus created<br \/>service\/prometheus created<br \/>deployment.apps\/prometheus created<\/pre>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><\/p>\n<p><\/p>\n<pre>[root@k8s-master istio-1.17.2]# kubectl rollout status deployment\/kiali -n istio-system<br \/>Waiting for deployment \"kiali\" rollout to finish: 0 of 1 updated replicas are available...<br \/>deployment \"kiali\" successfully rolled out<\/pre>\n<p class=\"wp-block-paragraph\"><strong>\u6ce8\u610f\uff1a<\/strong>\u5982\u679c\u5728\u5b89\u88c5\u63d2\u4ef6\u65f6\u51fa\u9519\uff0c\u518d\u8fd0\u884c\u4e00\u6b21\u547d\u4ee4\u3002\u6709\u4e00\u4e9b\u548c\u65f6\u95f4\u76f8\u5173\u7684\u95ee\u9898\uff0c\u518d\u6b21\u8fd0\u884c\u5c31\u80fd\u89e3\u51b3\u3002<\/p>\n<p>\u2461 \u8bbf\u95eeKiali\u4eea\u8868\u677f<\/p>\n<pre>[root@k8s-master istio-1.17.2]# istioctl dashboard --address 10.0.18.13 -p20001 kiali<br \/>http:\/\/10.0.18.13:20001\/kiali<\/pre>\n<p>\u901a\u8fc7\u6d4f\u89c8\u5668\u67e5\u770b\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/istio-kiali.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 2234px; --smush-placeholder-aspect-ratio: 2234\/2102;\" \/><\/p>\n<p>\u2462 \u5728\u5de6\u4fa7\u7684\u5bfc\u822a\u83dc\u5355\uff0c\u9009\u62e9Graph,\u7136\u540e\u518dNamespace\u4e0b\u62c9\u5217\u8868\u4e2d\uff0c\u9009\u62e9default\u3002<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/istio-kiali-1.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 2222px; --smush-placeholder-aspect-ratio: 2222\/1536;\" \/><\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/istio-kiali-2.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 2246px; --smush-placeholder-aspect-ratio: 2246\/1476;\" \/><\/p>\n<p>\u8981\u67e5\u770b\u8ffd\u8e2a\u6570\u636e\uff0c\u5fc5\u987b\u5411\u670d\u52a1\u53d1\u9001\u8bf7\u6c42\u3002\u8bf7\u6c42\u7684\u6570\u91cf\u53d6\u51b3\u4e8eIstio\u7684\u91c7\u6837\u7387\u3002\u91c7\u6837\u7387\u5728\u5b89\u88c5Istio\u65f6\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u91c7\u6837\u901f\u7387\u4e3a1%\u3002\u5728\u7b2c\u4e00\u4e2a\u8ddf\u8e2a\u53ef\u89c1\u4e4b\u524d\uff0c\u9700\u8981\u53d1\u9001\u81f3\u5c11100\u4e2a\u8bf7\u6c42\u3002\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5411productpage\u670d\u52a1\u53d1\u90011000\u4e2a\u8bf7\u6c42\uff1a<\/p>\n<pre>[root@k8s-master istio-1.17.2]# for i in `seq 1 1000`; do curl -s -o \/dev\/null http:\/\/10.0.18.13:31481\/productpage; done<\/pre>\n<p>Kiali\u4eea\u8868\u677f\u5c55\u793a\u4e86\u7f51\u683c\u7684\u6982\u89c8\u4ee5\u53caBookInfo\u793a\u4f8b\u5e94\u7528\u7684\u5404\u4e2a\u670d\u52a1\u4e4b\u95f4\u7684\u5173\u7cfb\u3002\u5b83\u8fd8\u63d0\u4f9b\u8fc7\u6ee4\u5668\u6765\u53ef\u89c6\u5316\u6d41\u91cf\u7684\u6d41\u52a8\u3002<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/istio-kiali-3.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 2570px; --smush-placeholder-aspect-ratio: 2570\/2058;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"4_%E6%B5%81%E9%87%8F%E7%AE%A1%E7%90%86\"><\/span>4. \u6d41\u91cf\u7ba1\u7406<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u4e3a\u4e86\u5728\u7f51\u683c\u4e2d\u5bfc\u6d41\uff0cIstio\u9700\u8981\u77e5\u9053\u6240\u6709\u7684endpoint\u5728\u54ea\u548c\u5c5e\u4e8e\u54ea\u4e2a\u670d\u52a1\u3002\u4e3a\u4e86\u5b9a\u4f4d\u5230service registry(\u670d\u52a1\u6ce8\u518c\u4e2d\u5fc3)\uff0cIstio\u4f1a\u8fde\u63a5\u5230\u4e00\u4e2a\u670d\u52a1\u53d1\u73b0\u7cfb\u7edf\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5728Kubernetes\u96c6\u7fa4\u4e0a\u5b89\u88c5\u4e86Istio\uff0c\u90a3\u4e48\u5b83\u5c06\u81ea\u52a8\u68c0\u6d4b\u8be5\u96c6\u7fa4\u4e2d\u7684\u670d\u52a1\u548cendpoint\u3002<\/p>\n<p>\u4f7f\u7528\u6b64\u670d\u52a1\u6ce8\u518c\u4e2d\u5fc3\uff0cEnvoy\u4ee3\u7406\u53ef\u4ee5\u5c06\u6d41\u91cf\u5b9a\u5411\u5230\u76f8\u5173\u670d\u52a1\u3002\u5927\u591a\u6570\u57fa\u4e8e\u5fae\u670d\u52a1\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u6bcf\u4e2a\u670d\u52a1\u7684\u5de5\u4f5c\u8d1f\u8f7d\u90fd\u6709\u591a\u4e2a\u5b9e\u4f8b\u6765\u5904\u7406\u6d41\u91cf\uff0c\u79f0\u4e3a\u8d1f\u8f7d\u5747\u8861\u6c60\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cEnvoy\u4ee3\u7406\u57fa\u4e8e\u8f6e\u8be2\u8c03\u5ea6\u6a21\u578b\u5728\u670d\u52a1\u7684\u8d1f\u8f7d\u5747\u8861\u6c60\u5185\u5206\u53d1\u6d41\u91cf\uff0c\u6309\u987a\u5e8f\u8bb2\u8bf7\u6c42\u53d1\u9001\u7ed9\u6c60\u4e2d\u6bcf\u4e2a\u6210\u5458\uff0c\u4e00\u65e6\u6240\u6709\u670d\u52a1\u5b9e\u4f8b\u5747\u63a5\u6536\u8fc7\u4e00\u6b21\u8bf7\u6c42\u540e\uff0c\u91cd\u65b0\u56de\u5230\u7b2c\u4e00\u4e2a\u6c60\u6210\u5458\u3002<\/p>\n<p>\u5728\u8bb8\u591a\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u5e0c\u671b\u5bf9\u7f51\u683c\u7684\u6d41\u91cf\u60c5\u51b5\u8fdb\u884c\u66f4\u7ec6\u7c92\u5ea6\u7684\u63a7\u5236\u3002\u4f5c\u4e3aA\/B\u6d4b\u8bd5\u7684\u4e00\u90e8\u5206\uff0c\u6211\u4eec\u53ef\u80fd\u60f3\u5c06\u7279\u5b9a\u767e\u5206\u6bd4\u7684\u6d41\u91cf\u5b9a\u5411\u5230\u65b0\u7248\u672c\u7684\u670d\u52a1\uff0c\u6216\u8005\u4e3a\u7279\u5b9a\u7684\u670d\u52a1\u5b9e\u4f8b\u5b50\u96c6\u5e94\u7528\u4e0d\u540c\u7684\u8d1f\u8f7d\u5747\u8861\u7b56\u7565\uff0c\u8fd8\u53ef\u80fd\u60f3\u5bf9\u8fdb\u51fa\u7f51\u683c\u7684\u6d41\u91cf\u5e94\u7528\u7279\u6b8a\u7684\u8d1f\u8d23\uff0c\u6216\u8005\u5c06\u7f51\u683c\u7684\u5916\u90e8\u4f9d\u8d56\u9879\u6dfb\u52a0\u5230\u670d\u52a1\u6ce8\u518c\u4e2d\u5fc3\uff0c\u90a3\u4e48\uff0c\u901a\u8fc7\u4f7f\u7528Istio\u7684\u6d41\u91cf\u7ba1\u7406API\u5c06\u6d41\u91cf\u914d\u7f6e\u6dfb\u52a0\u5230Istio\uff0c\u5c31\u53ef\u4ee5\u5b8c\u6210\u6240\u6709\u8fd9\u4e9b\u751a\u81f3\u66f4\u591a\u7684\u5de5\u4f5c\u3002<\/p>\n<p><strong>\u865a\u62df\u670d\u52a1<\/strong><\/p>\n<p>\u865a\u62df\u670d\u52a1\uff08Virtual Service\uff09\u548c\u76ee\u6807\u89c4\u5219\uff08Destination Rule\uff09\u662fIstio\u6d41\u91cf\u8def\u7531\u529f\u80fd\u7684\u5173\u952e\u62fc\u56fe\u3002\u865a\u62df\u670d\u52a1\u8ba9\u6211\u4eec\u7684\u914d\u7f6e\u5982\u4f55\u5728\u670d\u52a1\u7f51\u683c\u5185\u8bf7\u6c42\u8def\u7531\u5230\u670d\u52a1\uff0c\u8fd9\u57fa\u4e8eIstio\u548c\u5e73\u53f0\u63d0\u4f9b\u7684\u57fa\u672c\u7684\u8fde\u901a\u6027\u548c\u670d\u52a1\u53d1\u73b0\u80fd\u529b\u3002\u6bcf\u4e2a\u865a\u62df\u670d\u52a1\u5305\u542b\u4e00\u7ec4\u8def\u7531\u89c4\u5219\uff0cIstio\u6309\u987a\u5e8f\u8bc4\u4f30\u5b83\u4eec\uff0cIstio\u5c06\u6bcf\u4e2a\u7ed9\u5b9a\u7684\u8bf7\u6c42\u5339\u914d\u5230\u865a\u62df\u670d\u52a1\u6307\u5b9a\u7684\u5b9e\u9645\u76ee\u6807\u5730\u5740\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"41_%E9%85%8D%E7%BD%AE%E8%AF%B7%E6%B1%82%E8%B7%AF%E7%94%B1\"><\/span>4.1 \u914d\u7f6e\u8bf7\u6c42\u8def\u7531<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>\u2460 \u4e0d\u540c\u670d\u52a1\u7248\u672c\u8bbf\u95ee\u89c4\u5219<\/strong><\/p>\n<p>\u6211\u4eec\u5148\u521b\u5efaDestination Rule\u5bf9\u8c61\uff0cDestination Rule\u5bf9\u8c61\u662fVirtual Service\u8def\u7531\u751f\u6548\u540e\u914d\u7f6e\u5e94\u7528\u4e0e\u8bf7\u6c42\u7684\u7b56\u7565\u96c6\uff0c\u7528\u6765\u5c06Virtual Service\u4e2d\u6307\u5b9a\u7684subset\u4e0e\u5bf9\u5e94\u7684Pod\u5173\u8054\u8d77\u6765\u3002<\/p>\n<p>\u5728destination-rule-all.yaml\u6587\u4ef6\u4e2d\u6709\u5b9a\u4e49\u8be5\u5e94\u7528\u4e2d\u6240\u6709\u8981\u7528\u5230\u7684Destination Rule\u8d44\u6e90\u5bf9\u8c61\uff1a<\/p>\n<pre>[root@k8s-master networking]# cat destination-rule-all.yaml<br \/>apiVersion: networking.istio.io\/v1alpha3<br \/>kind: DestinationRule<br \/>metadata:<br \/>name: productpage<br \/>spec:<br \/>host: productpage<br \/>subsets:<br \/>- name: v1<br \/>labels:<br \/>version: v1<br \/>---<br \/>apiVersion: networking.istio.io\/v1alpha3<br \/>kind: DestinationRule<br \/>metadata:<br \/>name: reviews<br \/>spec:<br \/>host: reviews<br \/>subsets:<br \/>- name: v1<br \/>labels:<br \/>version: v1<br \/>- name: v2<br \/>labels:<br \/>version: v2<br \/>- name: v3<br \/>labels:<br \/>version: v3<br \/>......<\/pre>\n<pre>[root@k8s-master networking]# kubectl apply -f destination-rule-all.yaml<br \/>destinationrule.networking.istio.io\/productpage created<br \/>destinationrule.networking.istio.io\/reviews created<br \/>destinationrule.networking.istio.io\/ratings created<br \/>destinationrule.networking.istio.io\/details created<\/pre>\n<p>\u6211\u4eec\u521b\u5efa\u597dDestination Rule\u8d44\u6e90\u540e\uff0c\u53ef\u4ee5\u67e5\u770b\u6211\u4eec\u7f51\u683c\u4e2d\u7684Destination Rule\uff1a<\/p>\n<pre>[root@k8s-master networking]# kubectl get destinationrule<br \/>NAME HOST AGE<br \/>details details 3m12s<br \/>productpage productpage 3m12s<br \/>ratings ratings 3m12s<br \/>reviews reviews 3m12s<\/pre>\n<p>\u63a5\u7740\uff0c\u6211\u4eec\u6765\u521b\u5efa\u8def\u7531\u89c4\u5219\uff0c\u8def\u7531\u5230\u7248\u672c3\u3002\u4f7f\u7528virtual-service-reviews-v3.yaml\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre>[root@k8s-master networking]# cat virtual-service-reviews-v3.yaml<br \/>apiVersion: networking.istio.io\/v1alpha3<br \/>kind: VirtualService<br \/>metadata:<br \/>name: reviews<br \/>spec:<br \/>hosts:<br \/>- reviews<br \/>http:<br \/>- route:<br \/>- destination:<br \/>host: reviews<br \/>subset: v3<\/pre>\n<p>\u8fd9\u6837\uff0c\u6240\u6709\u8bbf\u95eereviews\u670d\u52a1\u7684\u6d41\u91cf\u5c31\u4f1a\u88ab\u5f15\u5bfc\u5230reviews\u670d\u52a1\u5bf9\u5e94\u7684subset\u4e3av3\u7684Pod\u4e2d\uff1a<\/p>\n<pre>[root@k8s-master networking]# kubectl apply -f virtual-service-reviews-v3.yaml<br \/>virtualservice.networking.istio.io\/reviews created<\/pre>\n<p>\u67e5\u770b\u8def\u7531\u89c4\u5219\uff1a<\/p>\n<pre>[root@k8s-master networking]# kubectl get virtualservice<br \/>NAME        GATEWAYS              HOSTS       AGE<br \/>bookinfo    [\"bookinfo-gateway\"]  [\"*\"]       25h<br \/>reviews                           [\"reviews\"] 71s<\/pre>\n<p>\u7136\u540e\uff0c\u6211\u4eec\u53bb\u591a\u6b21\u5237\u65b0\u9875\u9762\uff0c\u770b\u770b\u6548\u679c\uff1a<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/www.dataz8.com\/wp-content\/uploads\/2023\/06\/istio-productpage-TrafficManagement-DifferentServiceVersions.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 2374px; --smush-placeholder-aspect-ratio: 2374\/1252;\" \/><\/p>\n<p>\u591a\u6b21\u5237\u65b0\u540e\uff0c\u9875\u9762\u59cb\u7ec8\u5c55\u793a\u7684\u662fv3\u7248\u672c\uff0c\u5e26\u7ea2\u8272\u661f\u7684\uff0c\u8bf4\u660e\u6211\u4eecVirtual Service\u7684\u914d\u7f6e\u6210\u529f\u4e86\u3002<\/p>\n<p><strong>\u2461 \u57fa\u4e8e\u6743\u91cd\u7684\u670d\u52a1\u8bbf\u95ee\u89c4\u5219<\/strong><\/p>\n<p>\u6392\u9664\u5bf9\u73af\u5883\u7684\u5f71\u54cd\uff0c\u6211\u4eec\u5148\u628a\u521a\u521a\u521b\u5efa\u7684Virtual Service\u5bf9\u8c61\u5220\u9664\uff1a<\/p>\n<pre>[root@k8s-master networking]# kubectl delete virtualservice reviews<br \/>virtualservice.networking.istio.io \"reviews\" deleted<\/pre>\n<pre>[root@k8s-master networking]# kubectl get virtualservice<br \/>NAME GATEWAYS HOSTS AGE<br \/>bookinfo [\"bookinfo-gateway\"] [\"*\"] 25h<\/pre>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u67e5\u770b\u6587\u4ef6virtual-service-reviews-80-20.yaml\uff1a<\/p>\n<pre>[root@k8s-master networking]# cat virtual-service-reviews-80-20.yaml<br \/>apiVersion: networking.istio.io\/v1alpha3<br \/>kind: VirtualService<br \/>metadata:<br \/>name: reviews<br \/>spec:<br \/>hosts:<br \/>- reviews<br \/>http:<br \/>- route:<br \/>- destination:<br \/>host: reviews<br \/>subset: v1<br \/>weight: 80<br \/>- destination:<br \/>host: reviews<br \/>subset: v2<br \/>weight: 20<\/pre>\n<p>\u8fd9\u4e2a\u89c4\u5219\u5b9a\u4e49\u4e8680%\u7684\u6d41\u91cf\u6d41\u5165v1\uff0c20%\u7684\u6d41\u91cf\u6d41\u5165v2\uff0c\u6211\u4eec\u521b\u5efa\u8fd9\u4e2a\u8d44\u6e90\u5bf9\u8c61\uff1a<\/p>\n<pre>[root@k8s-master networking]# kubectl apply -f virtual-service-reviews-80-20.yaml<br \/>virtualservice.networking.istio.io\/reviews created<br \/>[root@k8s-master networking]# kubectl get virtualservice<br \/>NAME     GATEWAYS             HOSTS       AGE<br \/>bookinfo [\"bookinfo-gateway\"] [\"*\"]       25h<br \/>reviews                       [\"reviews\"] 17s<\/pre>\n<p>\u5728\u6d4f\u89c8\u5668\u4e0a\u8bbf\u95eeBookInfo\uff0c\u7ecf\u8fc7\u591a\u6b21\u5237\u65b0\uff0c\u53ef\u4ee5\u53d1\u73b0\uff0c\u6ca1\u6709\u51fa\u73b0Ratings\u7684\u6b21\u6570\u4e0e\u51fa\u73b0\u9ed1\u8272\u661f\u7684Ratings\u7684\u6bd4\u4f8b\u5927\u6982\u57284:1\u65f6\uff0c\u800c\u4e14\u4e5f\u6ca1\u6709\u51fa\u73b0\u7ea2\u8272\u661f\uff0c\u8bf4\u660e\u6211\u4eec\u57fa\u4e8e\u6743\u91cd\u7684\u914d\u7f6e\u5df2\u7ecf\u751f\u6548\u4e86\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u53c2\u8003\u94fe\u63a5\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">https:\/\/istio.io\/latest\/docs\/setup\/getting-started\/<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">https:\/\/zhuanlan.zhihu.com\/p\/421986295<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">https:\/\/cloud.tencent.com\/developer\/article\/2023843<\/p>\n<p><\/p>\n<p><\/p>\n<p class=\"wp-block-paragraph\">https:\/\/blog.nsfocus.net\/istio%E7%B3%BB%E5%88%97%E4%BA%8C%EF%BC%9Aenvoy%E7%BB%84%E4%BB%B6%E5%88%86%E6%9E%90\/<\/p>\n<p><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u5728\u65e9\u671f\uff0c\u6211\u4eec\u7684\u670d\u52a1\u662f\u5355\u4f53\u5e94\u7528\uff0c\u4e00\u4e2a\u5e94\u7528\u63d0\u4f9b\u4e86\u6240\u6709\u7684\u670d\u52a1\uff0c\u6240\u6709 &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_zb_attr":"","zolo_post_video_link":"","footnotes":""},"categories":[5],"tags":[],"series":[],"class_list":["post-369","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.dataz8.com\/index.php?rest_route=\/wp\/v2\/posts\/369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dataz8.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dataz8.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dataz8.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dataz8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=369"}],"version-history":[{"count":144,"href":"https:\/\/www.dataz8.com\/index.php?rest_route=\/wp\/v2\/posts\/369\/revisions"}],"predecessor-version":[{"id":641,"href":"https:\/\/www.dataz8.com\/index.php?rest_route=\/wp\/v2\/posts\/369\/revisions\/641"}],"wp:attachment":[{"href":"https:\/\/www.dataz8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dataz8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dataz8.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=369"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.dataz8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}