{"id":259,"date":"2025-09-30T08:19:29","date_gmt":"2025-09-30T00:19:29","guid":{"rendered":"http:\/\/52.76.12.94\/?p=259"},"modified":"2026-06-04T11:16:33","modified_gmt":"2026-06-04T03:16:33","slug":"istio-%e6%9c%8d%e5%8a%a1%e7%bd%91%e6%a0%bc%e6%9e%b6%e6%9e%84%e6%8a%80%e6%9c%af%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/flycloud.io\/en\/2025\/09\/30\/istio-%e6%9c%8d%e5%8a%a1%e7%bd%91%e6%a0%bc%e6%9e%b6%e6%9e%84%e6%8a%80%e6%9c%af%e8%af%a6%e8%a7%a3\/","title":{"rendered":"Istio \u670d\u52a1\u7f51\u683c\u67b6\u6784\u6280\u672f\u8be6\u89e3"},"content":{"rendered":"<h2 class=\"wp-block-heading\" id=\"1-\u670d\u52a1\u7f51\u683c\u7b80\u4ecb\">1. \u670d\u52a1\u7f51\u683c\u7b80\u4ecb<\/h2>\n\n\n\n<p>\u5728\u8fc7\u53bb\u7684\u51e0\u5e74\u4e2d\uff0c\u968f\u7740\u5fae\u670d\u52a1\u67b6\u6784\u7684\u666e\u53ca\uff0c\u7cfb\u7edf\u590d\u6742\u5ea6\u4e5f\u5728\u4e0d\u65ad\u63d0\u5347\u3002<strong>\u670d\u52a1\u7f51\u683c\uff08Service Mesh\uff09<\/strong> \u4f5c\u4e3a\u4e00\u79cd\u65b0\u5174\u7684\u67b6\u6784\u6a21\u5f0f\uff0c\u65e8\u5728\u89e3\u51b3\u5fae\u670d\u52a1\u4e4b\u95f4\u901a\u4fe1\u7684\u590d\u6742\u6027\u95ee\u9898\u3002<\/p>\n\n\n\n<p><strong>Istio<\/strong> \u662f\u5f53\u524d\u6700\u6d41\u884c\u7684\u670d\u52a1\u7f51\u683c\u5b9e\u73b0\u4e4b\u4e00\uff0c\u5b83\u80fd\u591f\u65e0\u7f1d\u96c6\u6210\u5230 Kubernetes \u7b49\u5bb9\u5668\u7f16\u6392\u5e73\u53f0\u4e2d\uff0c\u63d0\u4f9b\u6d41\u91cf\u7ba1\u7406\u3001\u5b89\u5168\u63a7\u5236\u3001\u53ef\u89c2\u6d4b\u6027\u7b49\u6838\u5fc3\u80fd\u529b\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-\u4ec0\u4e48\u662f\u670d\u52a1\u7f51\u683c\uff1f\">2. \u4ec0\u4e48\u662f\u670d\u52a1\u7f51\u683c\uff1f<\/h2>\n\n\n\n<p>\u670d\u52a1\u7f51\u683c\u662f\u4e00\u79cd\u4e13\u95e8\u5904\u7406\u670d\u52a1\u95f4\u901a\u4fe1\u7684\u57fa\u7840\u8bbe\u65bd\u5c42\u3002\u5b83\u901a\u8fc7\u4e00\u7ec4\u8f7b\u91cf\u7ea7\u7f51\u7edc\u4ee3\u7406\uff08sidecar\uff09\u6765\u63a5\u7ba1\u670d\u52a1\u4e4b\u95f4\u7684\u901a\u4fe1\u903b\u8f91\uff0c\u4ece\u800c\u5c06\u901a\u4fe1\u903b\u8f91\u4ece\u4e1a\u52a1\u4ee3\u7801\u4e2d\u5265\u79bb\u51fa\u6765\u3002<\/p>\n\n\n\n<p>\u670d\u52a1\u7f51\u683c\u4e3b\u8981\u89e3\u51b3\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u670d\u52a1\u53d1\u73b0<\/li>\n\n\n\n<li>\u8def\u7531\u63a7\u5236<\/li>\n\n\n\n<li>\u6545\u969c\u6062\u590d\uff08\u91cd\u8bd5\u3001\u7194\u65ad\uff09<\/li>\n\n\n\n<li>\u5b89\u5168\u4f20\u8f93\uff08mTLS\uff09<\/li>\n\n\n\n<li>\u53ef\u89c2\u6d4b\u6027\uff08\u76d1\u63a7\u3001\u8ffd\u8e2a\u3001\u65e5\u5fd7\uff09<\/li>\n<\/ul>\n\n\n\n<p>\u5728\u6ca1\u6709\u670d\u52a1\u7f51\u683c\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd9\u4e9b\u80fd\u529b\u901a\u5e38\u9700\u8981\u6bcf\u4e2a\u670d\u52a1\u81ea\u884c\u5b9e\u73b0\uff0c\u5bfc\u81f4\u4ee3\u7801\u91cd\u590d\u3001\u7ef4\u62a4\u56f0\u96be\u3002\u670d\u52a1\u7f51\u683c\u901a\u8fc7\u7edf\u4e00\u7684\u57fa\u7840\u8bbe\u65bd\u5c42\u6765\u96c6\u4e2d\u7ba1\u7406\u8fd9\u4e9b\u903b\u8f91\uff0c\u4f7f\u5f97\u4e1a\u52a1\u670d\u52a1\u66f4\u52a0\u8f7b\u91cf\u3001\u4e13\u6ce8\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.baeldung-cn.com\/wp-content\/uploads\/sites\/6\/2023\/03\/Service-Mesh-Before.webp\" alt=\"Service Mesh Before\"\/><\/figure>\n\n\n\n<p>\u4f7f\u7528\u670d\u52a1\u7f51\u683c\u540e\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.baeldung-cn.com\/wp-content\/uploads\/sites\/6\/2023\/03\/Service-Mesh-After.webp\" alt=\"Service Mesh After\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3-\u670d\u52a1\u7f51\u683c\u7684\u6838\u5fc3\u529f\u80fd\">3. \u670d\u52a1\u7f51\u683c\u7684\u6838\u5fc3\u529f\u80fd<\/h2>\n\n\n\n<p>\u670d\u52a1\u7f51\u683c\u7684\u529f\u80fd\u4e3b\u8981\u96c6\u4e2d\u5728\u4e09\u4e2a\u65b9\u9762\uff1a\u6d41\u91cf\u7ba1\u7406\u3001\u5b89\u5168\u548c\u53ef\u89c2\u6d4b\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"31-\u6d41\u91cf\u7ba1\u7406\">3.1 \u6d41\u91cf\u7ba1\u7406<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 <strong>\u52a8\u6001\u670d\u52a1\u53d1\u73b0\u4e0e\u8def\u7531<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u7070\u5ea6\u53d1\u5e03\u3001A\/B \u6d4b\u8bd5<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u91cd\u8bd5\u3001\u8d85\u65f6\u3001\u9650\u6d41\u3001\u7194\u65ad\u673a\u5236<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u8bf7\u6c42\u8def\u7531\u89c4\u5219\u914d\u7f6e\uff08VirtualService + DestinationRule\uff09<\/strong><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"32-\u5b89\u5168\">3.2 \u5b89\u5168<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 <strong>\u670d\u52a1\u95f4 mTLS \u52a0\u5bc6<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u8eab\u4efd\u8ba4\u8bc1\uff08Peer Authentication\uff09<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u8bbf\u95ee\u63a7\u5236\uff08AuthorizationPolicy\uff09<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u8bc1\u4e66\u81ea\u52a8\u7ba1\u7406<\/strong><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"33-\u53ef\u89c2\u6d4b\u6027\">3.3 \u53ef\u89c2\u6d4b\u6027<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 <strong>\u5206\u5e03\u5f0f\u8ffd\u8e2a\uff08\u652f\u6301 Zipkin\u3001Jaeger \u7b49\uff09<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u6307\u6807\u76d1\u63a7\uff08\u5ef6\u8fdf\u3001\u9519\u8bef\u7387\u3001\u6d41\u91cf\u7b49\uff09<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u8bbf\u95ee\u65e5\u5fd7\u8bb0\u5f55<\/strong><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4-istio-\u7b80\u4ecb\">4. Istio \u7b80\u4ecb<\/h2>\n\n\n\n<p>Istio \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u670d\u52a1\u7f51\u683c\u5b9e\u73b0\uff0c\u6700\u521d\u7531 IBM\u3001Google \u548c Lyft \u8054\u5408\u5f00\u53d1\u3002\u5b83\u901a\u8fc7\u5728\u6bcf\u4e2a\u670d\u52a1\u65c1\u90e8\u7f72\u4e00\u4e2a sidecar \u4ee3\u7406\uff08Envoy\uff09\u6765\u5b9e\u73b0\u670d\u52a1\u95f4\u901a\u4fe1\u7684\u63a7\u5236\u4e0e\u76d1\u63a7\u3002<\/p>\n\n\n\n<p>Istio \u7684\u6838\u5fc3\u4f18\u52bf\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 <strong>\u5e73\u53f0\u65e0\u5173\u6027<\/strong>\uff08\u652f\u6301 Kubernetes\u3001VM\u3001\u6df7\u5408\u4e91\uff09<\/li>\n\n\n\n<li>\u2705 <strong>\u53ef\u6269\u5c55\u6027\u5f3a<\/strong>\uff08\u652f\u6301\u63d2\u4ef6\u3001WebAssembly\uff09<\/li>\n\n\n\n<li>\u2705 <strong>\u529f\u80fd\u5168\u9762<\/strong>\uff08\u6db5\u76d6\u6d41\u91cf\u3001\u5b89\u5168\u3001\u53ef\u89c2\u6d4b\u6027\uff09<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"istio-\u67b6\u6784\u7ec4\u6210\">Istio \u67b6\u6784\u7ec4\u6210<\/h3>\n\n\n\n<p>Istio \u5206\u4e3a\u4e24\u4e2a\u6838\u5fc3\u5e73\u9762\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u6570\u636e\u5e73\u9762\uff08data-plane\uff09\">\u6570\u636e\u5e73\u9762\uff08Data Plane\uff09<\/h4>\n\n\n\n<p>\u7531\u6bcf\u4e2a\u670d\u52a1\u65c1\u7684 Envoy \u4ee3\u7406\u7ec4\u6210\uff0c\u8d1f\u8d23\u5b9e\u9645\u7684\u6d41\u91cf\u8f6c\u53d1\u4e0e\u63a7\u5236\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u63a7\u5236\u5e73\u9762\uff08control-plane\uff09\">\u63a7\u5236\u5e73\u9762\uff08Control Plane\uff09<\/h4>\n\n\n\n<p>\u7531 <code>istiod<\/code> \u7ec4\u4ef6\u8d1f\u8d23\uff0c\u63d0\u4f9b\u670d\u52a1\u53d1\u73b0\u3001\u914d\u7f6e\u5206\u53d1\u3001\u8bc1\u4e66\u7ba1\u7406\u7b49\u80fd\u529b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.baeldung-cn.com\/wp-content\/uploads\/sites\/6\/2023\/03\/Istio-Data-Plane.webp\" alt=\"Istio Data Plane\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.baeldung-cn.com\/wp-content\/uploads\/sites\/6\/2023\/03\/Istio-Control-Plane.webp\" alt=\"Istio Control Plane\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"5-istio-\u6838\u5fc3\u7ec4\u4ef6\u8be6\u89e3\">5. Istio \u6838\u5fc3\u7ec4\u4ef6\u8be6\u89e3<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"51-\u6570\u636e\u5e73\u9762\u7ec4\u4ef6\uff1aenvoy\">5.1 \u6570\u636e\u5e73\u9762\u7ec4\u4ef6\uff1aEnvoy<\/h3>\n\n\n\n<p>Envoy \u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684 L7 \u4ee3\u7406\uff0c\u652f\u6301 HTTP\u3001gRPC\u3001TCP \u7b49\u534f\u8bae\u3002Istio \u5728\u5176\u57fa\u7840\u4e0a\u505a\u4e86\u6269\u5c55\uff0c\u7528\u4e8e\u5b9e\u73b0\u670d\u52a1\u7f51\u683c\u4e2d\u7684\u6d41\u91cf\u63a7\u5236\u4e0e\u5b89\u5168\u7b56\u7565\u3002<\/p>\n\n\n\n<p>\u4e3b\u8981\u529f\u80fd\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 <strong>\u7ec6\u7c92\u5ea6\u8def\u7531\u89c4\u5219<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u7194\u65ad\u3001\u91cd\u8bd5\u3001\u9650\u6d41<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>mTLS \u52a0\u5bc6<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u63d2\u4ef6\u5316\u6269\u5c55\uff08\u57fa\u4e8e WebAssembly\uff09<\/strong><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"52-\u63a7\u5236\u5e73\u9762\u7ec4\u4ef6\uff1aistiod\">5.2 \u63a7\u5236\u5e73\u9762\u7ec4\u4ef6\uff1aistiod<\/h3>\n\n\n\n<p><code>istiod<\/code> \u662f Istio \u63a7\u5236\u5e73\u9762\u7684\u6838\u5fc3\u7ec4\u4ef6\uff0c\u6574\u5408\u4e86\u65e9\u671f\u7684 Pilot\u3001Galley\u3001Citadel\u3001Mixer \u7b49\u6a21\u5757\u3002\u5b83\u8d1f\u8d23\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 <strong>\u670d\u52a1\u53d1\u73b0\u4e0e\u914d\u7f6e\u5206\u53d1<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u8bc1\u4e66\u7b7e\u53d1\u4e0e\u8f6e\u6362<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>\u7b56\u7565\u6267\u884c\u4e0e\u5b89\u5168\u63a7\u5236<\/strong><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6-istio-\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1f\">6. Istio \u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"61-\u6d41\u91cf\u7ba1\u7406\">6.1 \u6d41\u91cf\u7ba1\u7406<\/h3>\n\n\n\n<p>\u901a\u8fc7 <code>VirtualService<\/code> \u548c <code>DestinationRule<\/code> \u5b9e\u73b0\u670d\u52a1\u95f4\u7684\u6d41\u91cf\u63a7\u5236\u3002<\/p>\n\n\n\n<p>\u793a\u4f8b\uff1a\u6309\u6743\u91cd\u5206\u53d1\u8bf7\u6c42\u5230\u4e0d\u540c\u7248\u672c\u7684\u670d\u52a1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: networking.istio.io\/v1alpha3\nkind: VirtualService\nmetadata:\n  name: shipping-service\nspec:\n  hosts:\n    - shipping-service\n  http:\n  - route:\n    - destination:\n        host: shipping-service\n        subset: v1\n      weight: 90\n    - destination:\n        host: shipping-service\n        subset: v2\n      weight: 10\n---\napiVersion: networking.istio.io\/v1alpha3\nkind: DestinationRule\nmetadata:\n  name: shipping-service\nspec:\n  host: shipping-service\n  subsets:\n  - name: v1\n    labels:\n      version: v1\n  - name: v2\n    labels:\n      version: v2\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"62-\u5b89\u5168\">6.2 \u5b89\u5168<\/h3>\n\n\n\n<p>Istio \u652f\u6301\u4e24\u79cd\u8ba4\u8bc1\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Peer Authentication<\/strong>\uff1a\u670d\u52a1\u95f4\u8ba4\u8bc1\uff08mTLS\uff09<\/li>\n\n\n\n<li><strong>Request Authentication<\/strong>\uff1a\u7528\u6237\u7ea7\u8ba4\u8bc1\uff08JWT\uff09<\/li>\n<\/ul>\n\n\n\n<p>\u793a\u4f8b\uff1a\u5f3a\u5236 mTLS \u901a\u4fe1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: \"security.istio.io\/v1beta1\"\nkind: \"PeerAuthentication\"\nmetadata:\n  name: \"default\"\n  namespace: \"istio-system\"\nspec:\n  mtls:\n    mode: STRICT\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"63-\u53ef\u89c2\u6d4b\u6027\">6.3 \u53ef\u89c2\u6d4b\u6027<\/h3>\n\n\n\n<p>Istio \u81ea\u52a8\u751f\u6210\u4e30\u5bcc\u7684\u6307\u6807\u3001\u65e5\u5fd7\u548c\u5206\u5e03\u5f0f\u8ffd\u8e2a\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u652f\u6301\u7684\u540e\u7aef\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 <strong>Zipkin<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>Jaeger<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>Prometheus<\/strong><\/li>\n\n\n\n<li>\u2705 <strong>Datadog<\/strong><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"7-\u5b9e\u6218\uff1a\u90e8\u7f72-istio-\u5e76\u63a5\u5165\u5e94\u7528\">7. \u5b9e\u6218\uff1a\u90e8\u7f72 Istio \u5e76\u63a5\u5165\u5e94\u7528<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"71-\u5b89\u88c5-istio\">7.1 \u5b89\u88c5 Istio<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>istioctl install --set profile=demo -y\nkubectl label namespace default istio-injection=enabled\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"72-\u793a\u4f8b\u5e94\u7528\uff1a\u8ba2\u5355\u7cfb\u7edf\">7.2 \u793a\u4f8b\u5e94\u7528\uff1a\u8ba2\u5355\u7cfb\u7edf<\/h3>\n\n\n\n<p>\u5305\u542b\u4e09\u4e2a\u5fae\u670d\u52a1\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>order-service<\/code><\/li>\n\n\n\n<li><code>inventory-service<\/code><\/li>\n\n\n\n<li><code>shipping-service<\/code><\/li>\n<\/ul>\n\n\n\n<p>\u5747\u4f7f\u7528 Spring Boot \u6784\u5efa\u5e76\u6253\u5305\u4e3a Docker \u955c\u50cf\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"73-\u90e8\u7f72\u670d\u52a1\">7.3 \u90e8\u7f72\u670d\u52a1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: order-service\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: order-service\n  template:\n    metadata:\n      labels:\n        app: order-service\n        version: v1\n    spec:\n      containers:\n      - name: order-service\n        image: kchandrakant\/order-service:v1\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: order-service\nspec:\n  selector:\n    app: order-service\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 80\n<\/code><\/pre>\n\n\n\n<p>\u90e8\u7f72\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl apply -f order-service.yaml -f inventory-service.yaml -f shipping-service.yaml\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"74-\u914d\u7f6e\u7f51\u5173\u8bbf\u95ee\">7.4 \u914d\u7f6e\u7f51\u5173\u8bbf\u95ee<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: networking.istio.io\/v1alpha3\nkind: Gateway\nmetadata:\n  name: order-gateway\nspec:\n  selector:\n    istio: ingressgateway\n  servers:\n  - port:\n      number: 80\n      name: http\n      protocol: HTTP\n    hosts:\n    - \"*\"\n---\napiVersion: networking.istio.io\/v1alpha3\nkind: VirtualService\nmetadata:\n  name: order\nspec:\n  hosts:\n  - \"*\"\n  gateways:\n  - order-gateway\n  http:\n  - match:\n    - uri:\n        prefix: \/api\/v1\/order\n    route:\n    - destination:\n        host: order-service\n        port:\n          number: 80\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"8-istio-\u5e38\u89c1\u4f7f\u7528\u573a\u666f\">8. Istio \u5e38\u89c1\u4f7f\u7528\u573a\u666f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"81-\u8bf7\u6c42\u8def\u7531\">8.1 \u8bf7\u6c42\u8def\u7531<\/h3>\n\n\n\n<p>\u652f\u6301\u57fa\u4e8e\u6743\u91cd\u3001Header\u3001\u6e90 IP \u7b49\u6761\u4ef6\u8fdb\u884c\u8def\u7531\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"82-\u7194\u65ad\u673a\u5236\">8.2 \u7194\u65ad\u673a\u5236<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: networking.istio.io\/v1alpha3\nkind: DestinationRule\nmetadata:\n  name: inventory-service\nspec:\n  host: inventory-service\n  trafficPolicy:\n    connectionPool:\n      tcp:\n        maxConnections: 1\n    outlierDetection:\n      consecutive5xxErrors: 1\n      interval: 1s\n      baseEjectionTime: 3m\n      maxEjectionPercent: 100\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"83-\u542f\u7528-mtls\">8.3 \u542f\u7528 mTLS<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: \"security.istio.io\/v1beta1\"\nkind: \"PeerAuthentication\"\nmetadata:\n  name: \"default\"\n  namespace: \"istio-system\"\nspec:\n  mtls:\n    mode: STRICT\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"84-jwt-\u8ba4\u8bc1\">8.4 JWT \u8ba4\u8bc1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: security.istio.io\/v1beta1\nkind: AuthorizationPolicy\nmetadata:\n  name: require-jwt\n  namespace: default\nspec:\n  selector:\n    matchLabels:\n      app: order-service\n  action: ALLOW\n  rules:\n  - from:\n    - source:\n       requestPrincipals: &#91;\"&#91;email&nbsp;protected]\/&#91;email&nbsp;protected]\"]\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"9-\u601d\u8003\u4e0e\u5efa\u8bae\">9. \u601d\u8003\u4e0e\u5efa\u8bae<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"91-\u662f\u5426\u5fc5\u987b\u4f7f\u7528\u670d\u52a1\u7f51\u683c\uff1f\">9.1 \u662f\u5426\u5fc5\u987b\u4f7f\u7528\u670d\u52a1\u7f51\u683c\uff1f<\/h3>\n\n\n\n<p>\u4e0d\u662f\u6240\u6709\u573a\u666f\u90fd\u9002\u5408\u5f15\u5165 Istio\uff0c\u4f7f\u7528\u524d\u9700\u8bc4\u4f30\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u274c <strong>\u670d\u52a1\u6570\u91cf\u5c11\u3001\u901a\u4fe1\u903b\u8f91\u7b80\u5355<\/strong><\/li>\n\n\n\n<li>\u274c <strong>\u5df2\u6709\u6210\u719f\u7684\u901a\u4fe1\u63a7\u5236\u903b\u8f91\uff08\u5982\u7194\u65ad\u3001\u9650\u6d41\uff09<\/strong><\/li>\n\n\n\n<li>\u274c <strong>\u5bf9\u5ef6\u8fdf\u654f\u611f\u7684\u7cfb\u7edf<\/strong><\/li>\n\n\n\n<li>\u274c <strong>\u56e2\u961f\u7f3a\u4e4f\u8fd0\u7ef4 Istio \u7684\u80fd\u529b<\/strong><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"92-istio-\u66ff\u4ee3\u65b9\u6848\">9.2 Istio \u66ff\u4ee3\u65b9\u6848<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u5de5\u5177<\/th><th>\u7279\u70b9<\/th><\/tr><\/thead><tbody><tr><td><strong>Linkerd<\/strong><\/td><td>\u8f7b\u91cf\u7ea7\uff0c\u4ec5\u652f\u6301 Kubernetes\uff0c\u6027\u80fd\u4f18\u4e8e Istio<\/td><\/tr><tr><td><strong>Consul<\/strong><\/td><td>HashiCorp \u51fa\u54c1\uff0c\u652f\u6301\u591a\u5e73\u53f0\uff08K8s\u3001Nomad\uff09\uff0c\u529f\u80fd\u5168\u9762\u4f46\u90e8\u7f72\u590d\u6742<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"10-\u5c0f\u7ed3\">10. \u5c0f\u7ed3<\/h2>\n\n\n\n<p>Istio \u662f\u670d\u52a1\u7f51\u683c\u9886\u57df\u6700\u6210\u719f\u3001\u529f\u80fd\u6700\u5168\u9762\u7684\u5b9e\u73b0\u4e4b\u4e00\u3002\u5b83\u901a\u8fc7\u900f\u660e\u7684\u4ee3\u7406\u673a\u5236\uff0c\u5e2e\u52a9\u6211\u4eec\u7edf\u4e00\u7ba1\u7406\u5fae\u670d\u52a1\u4e4b\u95f4\u7684\u901a\u4fe1\u3001\u5b89\u5168\u548c\u53ef\u89c2\u6d4b\u6027\u3002<\/p>\n\n\n\n<p>\u4f46\u4e0e\u6b64\u540c\u65f6\uff0c\u5b83\u4e5f\u5e26\u6765\u4e86\u90e8\u7f72\u590d\u6742\u5ea6\u3001\u6027\u80fd\u5f00\u9500\u548c\u5b66\u4e60\u66f2\u7ebf\u3002\u662f\u5426\u5f15\u5165 Istio\uff0c\u5e94\u57fa\u4e8e\u56e2\u961f\u80fd\u529b\u3001\u7cfb\u7edf\u89c4\u6a21\u548c\u4e1a\u52a1\u9700\u6c42\u7efc\u5408\u5224\u65ad\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>1. \u670d\u52a1\u7f51\u683c\u7b80\u4ecb \u5728\u8fc7\u53bb\u7684\u51e0\u5e74\u4e2d\uff0c\u968f\u7740\u5fae\u670d\u52a1\u67b6\u6784\u7684\u666e\u53ca\uff0c\u7cfb\u7edf\u590d\u6742\u5ea6\u4e5f\u5728\u4e0d\u65ad\u63d0\u5347\u3002\u670d\u52a1\u7f51\u683c\uff08Service Mesh\uff09 \u4f5c\u4e3a\u4e00\u79cd\u65b0\u5174\u7684\u67b6\u6784\u6a21\u5f0f\uff0c\u65e8\u5728\u89e3\u51b3\u5fae\u670d\u52a1\u4e4b\u95f4\u901a\u4fe1\u7684\u590d\u6742\u6027\u95ee\u9898\u3002 Istio \u662f\u5f53\u524d\u6700\u6d41\u884c\u7684\u670d\u52a1\u7f51\u683c\u5b9e\u73b0\u4e4b\u4e00\uff0c\u5b83\u80fd\u591f\u65e0\u7f1d\u96c6\u6210\u5230 Kubernetes \u7b49\u5bb9\u5668\u7f16\u6392\u5e73\u53f0\u4e2d\uff0c\u63d0\u4f9b\u6d41\u91cf\u7ba1\u7406\u3001\u5b89\u5168\u63a7\u5236\u3001\u53ef\u89c2\u6d4b\u6027\u7b49\u6838\u5fc3\u80fd\u529b\u3002 2. \u4ec0\u4e48\u662f\u670d\u52a1\u7f51\u683c\uff1f \u670d\u52a1\u7f51\u683c\u662f\u4e00\u79cd\u4e13\u95e8\u5904\u7406\u670d\u52a1\u95f4\u901a\u4fe1\u7684\u57fa\u7840\u8bbe\u65bd\u5c42\u3002&hellip;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7],"tags":[],"class_list":["post-259","post","type-post","status-publish","format-standard","hentry","category-aws","category-servicemesh"],"_links":{"self":[{"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/posts\/259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/comments?post=259"}],"version-history":[{"count":2,"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":333,"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/posts\/259\/revisions\/333"}],"wp:attachment":[{"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/media?parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/categories?post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flycloud.io\/en\/wp-json\/wp\/v2\/tags?post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}