istio.io/archive/v1.2/zh/blog/2018/egress-tcp/index.html

106 lines
45 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html><html lang=zh itemscope itemtype=https://schema.org/WebPage><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=theme-color content=#466BB0><meta name=title content="使用外部 TCP 服务"><meta name=description content="描述基于 Istio 的 Bookinfo 示例的简单场景。"><meta name=author content="Vadim Eisenberg"><meta name=keywords content=microservices,services,mesh,traffic-management,egress,tcp><meta property=og:title content="使用外部 TCP 服务"><meta property=og:type content=website><meta property=og:description content="描述基于 Istio 的 Bookinfo 示例的简单场景。"><meta property=og:url content=/v1.2/zh/blog/2018/egress-tcp/><meta property=og:image content=/v1.2/img/istio-whitelogo-bluebackground-framed.svg><meta property=og:image:alt content="Istio Logo"><meta property=og:image:width content=112><meta property=og:image:height content=150><meta property=og:site_name content=Istio><meta name=twitter:card content=summary><meta name=twitter:site content=@IstioMesh><title>Istioldie 1.2 / 使用外部 TCP 服务</title><script async src="https://www.googletagmanager.com/gtag/js?id=UA-98480406-2"></script><script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
gtag('js',new Date());gtag('config','UA-98480406-2');</script><link rel=alternate type=application/rss+xml title="Istio Blog" href=/v1.2/feed.xml><link rel="shortcut icon" href=/v1.2/favicons/favicon.ico><link rel=apple-touch-icon href=/v1.2/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/v1.2/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/v1.2/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/v1.2/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/v1.2/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/v1.2/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/v1.2/favicons/android-96x96.png sizes=96xW96><link rel=icon type=image/png href=/v1.2/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/v1.2/favicons/android-192x192.png sizes=192x192><link rel=manifest href=/v1.2/manifest.json><meta name=apple-mobile-web-app-title content=Istio><meta name=application-name content=Istio><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Work+Sans:400|Chivo:400|Work+Sans:500,300,600,300italic,400italic,500italic,600italic|Chivo:500,300,600,300italic,400italic,500italic,600italic"><link rel=stylesheet href=/v1.2/css/all.css><script src=/v1.2/js/themes_init.min.js></script></head><body class="language-unknown archive-site"><script>const branchName="release-1.2";const docTitle="使用外部 TCP 服务";const iconFile="\/v1.2/img/icons.svg";const buttonCopy='复制到剪切板';const buttonPrint='打印';const buttonDownload='下载';</script><script src="https://www.google.com/cse/brand?form=search-form" defer></script><script src=/v1.2/js/all.min.js data-manual defer></script><header><nav><a id=brand href=/v1.2/zh/><span class=logo><svg viewBox="0 0 300 300"><circle cx="150" cy="150" r="146" stroke-width="2" /><path d="M65 240H225L125 270z"/><path d="M65 230l60-10V110z"/><path d="M135 220l90 10L135 30z"/></svg></span><span class=name>Istioldie 1.2</span></a><div id=hamburger><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#hamburger"/></svg></div><div id=header-links><a title="了解如何部署、使用和运维 Istio。" href=/v1.2/zh/docs/>文档</a>
<span title="关于使用 Istio 的博客文章。">博客</span>
<a title=关于Istio的常见问题。 href=/v1.2/zh/faq/>FAQ</a>
<a title=关于Istio的说明。 href=/v1.2/zh/about/>关于</a><div class=menu><button id=gearDropdownButton class=menu-trigger title=选项和设置 aria-label="Options and Settings" aria-controls=gearDropdownContent><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#gear"/></svg></button><div id=gearDropdownContent class=menu-content aria-labelledby=gearDropdownButton role=menu><a tabindex=-1 role=menuitem lang=en id=switch-lang-en>English</a>
<a tabindex=-1 role=menuitem lang=zh id=switch-lang-zh class=active>中文</a><div role=separator></div><a tabindex=-1 role=menuitem class=active id=light-theme-item>亮主题</a>
<a tabindex=-1 role=menuitem id=dark-theme-item>暗主题</a><div role=separator></div><a tabindex=-1 role=menuitem id=syntax-coloring-item>代码高亮</a><div role=separator></div><h6>本站的其它版本</h6><a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://istio.io/blog\/2018\/egress-tcp\/');return false;">当前版本</a>
<a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://preliminary.istio.io/blog\/2018\/egress-tcp\/');return false;">下个版本</a>
<a tabindex=-1 role=menuitem href=https://archive.istio.io>旧版本</a></div></div><button id=search-show title=搜索istio.io aria-label=Search><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#magnifier"/></svg></button></div><form id=search-form name=cse role=search><input type=hidden name=cx value=013699703217164175118:iwwf17ikgf4>
<input type=hidden name=ie value=utf-8>
<input type=hidden name=hl value=en>
<input type=hidden id=search-page-url value=/v1.2/search.html>
<input id=search-textbox class=form-control name=q type=search aria-label=搜索istio.io>
<button id=search-close title="Cancel search" type=reset aria-label="Cancel search"><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#cancel-x"/></svg></button></form></nav></header><main class=primary><div id=sidebar-container class="sidebar-container sidebar-offcanvas"><nav id=sidebar aria-label="Section Navigation"><div class=directory><div class=card><button class="header dynamic" id=card0 title="2019 年的博客文章。" aria-controls=card0-body><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#blog"/></svg>2019 年的博客文章</button><div class=body aria-labelledby=card0 role=region id=card0-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card0><li role=none><a role=treeitem title="Istio 1.1.3。" href=/v1.2/zh/blog/2019/announcing-1.1.3/>安全更新:发布 Istio 1.1.3</a></li><li role=none><a role=treeitem title="Istio 1.0.7 的补丁版本。" href=/v1.2/zh/blog/2019/announcing-1.0.7/>安全更新:发布 Istio 1.0.7</a></li><li role=none><a role=treeitem title="Istio 1.1.2 的补丁版本。" href=/v1.2/zh/blog/2019/announcing-1.1.2/>安全更新:发布 Istio 1.1.2</a></li><li role=none><a role=treeitem title="Istio 1.1 发布声明。" href=/v1.2/zh/blog/2019/announcing-1.1/>宣布 Istio 1.1 发布</a></li><li role=none><a role=treeitem title="Istio 1.1 性能概览." href=/v1.2/zh/blog/2019/istio1.1_perf/>面向性能而架构的 Istio 1.1</a></li><li role=none><a role=treeitem title="Istio 1.0.6 补丁版本。" href=/v1.2/zh/blog/2019/announcing-1.0.6/>Istio 1.0.6 发布</a></li><li role=none><a role=treeitem title="在多集群服务网格环境中配置 Istio 的路由规则。" href=/v1.2/zh/blog/2019/multicluster-version-routing/>多集群服务网格中的分版本路由</a></li><li role=none><a role=treeitem title=宣布新的博客策略。 href=/v1.2/zh/blog/2019/sail-the-blog/>博客策略更新</a></li><li role=none><a role=treeitem title="评估加入 Egress gateway 对性能造成的影响。" href=/v1.2/zh/blog/2019/egress-performance/>Egress gateway 性能测试</a></li><li role=none><a role=treeitem title="Istio 将数据面组件注入到现存部署之中的过程。" href=/v1.2/zh/blog/2019/data-plane-setup/>Istio Sidecar 注入过程解密</a></li><li role=none><a role=treeitem title="使用 AppSwitch 解决应用程序启动顺序和启动延迟。" href=/v1.2/zh/blog/2019/appswitch/>使用 AppSwitch 进行 Sidestepping 依赖性排序</a></li><li role=none><a role=treeitem title="如何使用 cert-manager 手工部署一个自定义 Ingress 网关。" href=/v1.2/zh/blog/2019/custom-ingress-gateway/>使用 Cert-Manager 部署一个自定义 Ingress 网关</a></li><li role=none><a role=treeitem title="Istio 推出新的讨论板。" href=/v1.2/zh/blog/2019/announcing-discuss.istio.io/>宣布 discuss.istio.io</a></li></ul></div></div><div class=card><button class="header dynamic" id=card1 title="2017 年的博客文章。" aria-controls=card1-body><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#blog"/></svg>2017 年的博客文章</button><div class=body aria-labelledby=card1 role=region id=card1-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card1><li role=none><a role=treeitem title=提高可用,降低延迟。 href=/v1.2/zh/blog/2017/mixer-spof-myth/>Mixer 和 SPOF 神话</a></li><li role=none><a role=treeitem title="概要说明 Mixer 的插件架构。" href=/v1.2/zh/blog/2017/adapter-model/>Mixer 适配器模型</a></li><li role=none><a role=treeitem title="Istio 0.2 公告。" href=/v1.2/zh/blog/2017/0.2-announcement/>宣布 Istio 0.2</a></li><li role=none><a role=treeitem title="Istio 的策略如何关联 Kubernetes 的网络策略 。" href=/v1.2/zh/blog/2017/0.1-using-network-policy/>Istio 使用网络策略</a></li><li role=none><a role=treeitem title="使用 Istio 创建自动缩放的金丝雀部署。" href=/v1.2/zh/blog/2017/0.1-canary/>使用 Istio 进行金丝雀部署</a></li><li role=none><a role=treeitem title="Istio Auth 0.1 公告。" href=/v1.2/zh/blog/2017/0.1-auth/>使用 Istio 增强端到端安全</a></li><li role=none><a role=treeitem title="Istio 0.1 宣布。" href=/v1.2/zh/blog/2017/0.1-announcement/>初次了解 Istio</a></li></ul></div></div><div class=card><button class="header dynamic" id=card2 title="2018 年的博客文章。" aria-controls=card2-body><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#blog"/></svg>2018 年的博客文章</button><div class="body default" aria-labelledby=card2 role=region id=card2-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card2><li role=none><a role=treeitem title="Istio 1.0.5 补丁版本发布。" href=/v1.2/zh/blog/2018/announcing-1.0.5/>Istio 1.0.5 发布</a></li><li role=none><a role=treeitem title="Istio 1.0.4 补丁版本发布。" href=/v1.2/zh/blog/2018/announcing-1.0.4/>Istio 1.0.4 发布</a></li><li role=none><a role=treeitem title="如何在不部署 Sidecar 代理的情况下使用 Istio 进行流量管理。" href=/v1.2/zh/blog/2018/incremental-traffic-management/>增量式应用 Istio 第一部分,流量管理</a></li><li role=none><a role=treeitem title="描述了一个基于 Istio 的 Bookinfo 示例的简单场景。" href=/v1.2/zh/blog/2018/egress-mongo/>使用外部 MongoDB 服务</a></li><li role=none><a role=treeitem title="Istio 1.0.3 修补版本。" href=/v1.2/zh/blog/2018/announcing-1.0.3/>宣布 Istio 1.0.3</a></li><li role=none><a role=treeitem title="Istio 1.0.2 补丁版本." href=/v1.2/zh/blog/2018/announcing-1.0.2/>Istio 1.0.2 发布</a></li><li role=none><a role=treeitem title="Istio 1.0.1 补丁版本。" href=/v1.2/zh/blog/2018/announcing-1.0.1/>Istio 1.0.1 发布</a></li><li role=none><a role=treeitem title="Istio 在 Twitch 举办了为期一天的直播庆祝 1.0 的发布。" href=/v1.2/zh/blog/2018/istio-twitch-stream/>Istio 在 Twitch 上全天直播</a></li><li role=none><a role=treeitem title="惠普如何在 Istio 上构建其下一代鞋类个性化平台。" href=/v1.2/zh/blog/2018/hp/>Istio 是惠普 FitStation 平台的改变者</a></li><li role=none><a role=treeitem title="Istio 1.0 已生产就绪。" href=/v1.2/zh/blog/2018/announcing-1.0/>宣布 Istio 1.0</a></li><li role=none><a role=treeitem title="使用 AppSwitch 自动接入应用并降低延迟。" href=/v1.2/zh/blog/2018/delayering-istio/>使用 AppSwitch 精简 Istio 层次</a></li><li role=none><a role=treeitem title="描述 Istio 的授权功能以及如何在各种用例中使用它。" href=/v1.2/zh/blog/2018/istio-authorization/>基于 Istio 的 Micro-Segmentation 授权</a></li><li role=none><a role=treeitem title="如何通过 Stackdriver 将 Istio 访问日志导出到 BigQuery、GCS、Pub/Sub 等不同的接收器。" href=/v1.2/zh/blog/2018/export-logs-through-stackdriver/>通过 Stackdriver 将日志导出到 BigQuery、GCS、Pub/Sub</a></li><li role=none><a role=treeitem title="描述如何配置 Istio 进行 HTTP Egress 流量监控和访问策略。" href=/v1.2/zh/blog/2018/egress-monitoring-access-control/>HTTP Egress 流量监控和访问策略</a></li><li role=none><a role=treeitem title="Istio v1alpha3 路由 API 介绍,动机及其设计原则。" href=/v1.2/zh/blog/2018/v1alpha3-routing/>Istio v1aplha3 路由 API 介绍</a></li><li role=none><a role=treeitem title="描述如何在AWS上使用网络负载均衡器配置 Istio Ingress。" href=/v1.2/zh/blog/2018/aws-nlb/>使用AWS NLB 配置 Istio Ingress</a></li><li role=none><a role=treeitem title="使用 Kubernetes 命名空间和 RBAC 为 Istio 构建软性多租户环境。" href=/v1.2/zh/blog/2018/soft-multitenancy/>Istio 的软性多租户支持</a></li><li role=none><a role=treeitem title=介绍更安全,低风险的部署和发布到生产。 href=/v1.2/zh/blog/2018/traffic-mirroring/>用于在生产环境进行测试的 Istio 流量镜像功能</a></li><li role=none><span role=treeitem class=current title="描述基于 Istio 的 Bookinfo 示例的简单场景。">使用外部 TCP 服务</span></li><li role=none><a role=treeitem title="描述基于 Istio Bookinfo 示例的简单场景。" href=/v1.2/zh/blog/2018/egress-https/>使用外部 Web 服务</a></li></ul></div></div></div></nav></div><div class=article-container><button tabindex=-1 id=sidebar-toggler title=折叠导航栏><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#pull"/></svg></button><nav aria-label=Breadcrumb><ol><li><a href=/v1.2/zh/>Istio</a></li><li><a href=/v1.2/zh/blog/ title="关于使用 Istio 的博客文章。">博客</a></li><li><a href=/v1.2/zh/blog/2018/ title="2018 年的博客文章。">2018 年的博客文章</a></li><li>使用外部 TCP 服务</li></ol></nav><article aria-labelledby=title><div class=title-area><div><h1 id=title>使用外部 TCP 服务</h1><p class=subtitle>网格外部 TCP 流量的服务入口</p><p class=byline><span>作者</span>
<span class=attribution>Vadim Eisenberg</span><span> | </span><span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#calendar"/></svg><span>&nbsp;</span>2018年2月6日</span><span> | </span><span title="840 字"><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#clock"/></svg><span>&nbsp;</span>阅读大约需要 4 分钟</span></p></div></div><nav class=toc-inlined aria-label="Table of Contents"><div><hr><ol><li role=none aria-label="Bookinfo 示例应用程序与外部评级数据库"><a href=#bookinfo-%e7%a4%ba%e4%be%8b%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e4%b8%8e%e5%a4%96%e9%83%a8%e8%af%84%e7%ba%a7%e6%95%b0%e6%8d%ae%e5%ba%93>Bookinfo 示例应用程序与外部评级数据库</a><ol><li role=none aria-label=为评级数据设置数据库><a href=#%e4%b8%ba%e8%af%84%e7%ba%a7%e6%95%b0%e6%8d%ae%e8%ae%be%e7%bd%ae%e6%95%b0%e6%8d%ae%e5%ba%93>为评级数据设置数据库</a><li role=none aria-label="Bookinfo 应用程序的初始设置"><a href=#bookinfo-%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e7%9a%84%e5%88%9d%e5%a7%8b%e8%ae%be%e7%bd%ae>Bookinfo 应用程序的初始设置</a><li role=none aria-label="将数据库用于 Bookinfo 应用程序中的评级数据"><a href=#%e5%b0%86%e6%95%b0%e6%8d%ae%e5%ba%93%e7%94%a8%e4%ba%8e-bookinfo-%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e4%b8%ad%e7%9a%84%e8%af%84%e7%ba%a7%e6%95%b0%e6%8d%ae>将数据库用于 Bookinfo 应用程序中的评级数据</a><li role=none aria-label=访问网页><a href=#%e8%ae%bf%e9%97%ae%e7%bd%91%e9%a1%b5>访问网页</a><li role=none aria-label="外部 MySQL 实例的网格外部服务入口"><a href=#%e5%a4%96%e9%83%a8-mysql-%e5%ae%9e%e4%be%8b%e7%9a%84%e7%bd%91%e6%a0%bc%e5%a4%96%e9%83%a8%e6%9c%8d%e5%8a%a1%e5%85%a5%e5%8f%a3>外部 MySQL 实例的网格外部服务入口</a></ol></li><li role=none aria-label="出口 TCP 流量控制的动机"><a href=#%e5%87%ba%e5%8f%a3-tcp-%e6%b5%81%e9%87%8f%e6%8e%a7%e5%88%b6%e7%9a%84%e5%8a%a8%e6%9c%ba>出口 TCP 流量控制的动机</a><li role=none aria-label="TCP 流量的服务入口"><a href=#tcp-%e6%b5%81%e9%87%8f%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%85%a5%e5%8f%a3>TCP 流量的服务入口</a><li role=none aria-label=与网格扩展的关系><a href=#%e4%b8%8e%e7%bd%91%e6%a0%bc%e6%89%a9%e5%b1%95%e7%9a%84%e5%85%b3%e7%b3%bb>与网格扩展的关系</a><li role=none aria-label=清理><a href=#%e6%b8%85%e7%90%86>清理</a><li role=none aria-label=结论><a href=#%e7%bb%93%e8%ae%ba>结论</a><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol><hr></div></nav><p>这篇博客在2018年7月23日有修改修改的内容使用了新的 <a href=/v1.2/zh/blog/2018/v1alpha3-routing/>v1alpha3 流量管理 API</a>。如果你想使用旧版本 API请参考<a href=https://archive.istio.io/v0.7/blog/2018/egress-tcp.html>这个文档</a></p><p>在我之前的博客文章<a href=/v1.2/zh/blog/2018/egress-https/>使用外部Web服务</a>中,我描述了如何通过 HTTPS 在网格 Istio 应用程序中使用外部服务,在这篇文章中,我演示了通过 TCP 使用外部服务。你会用到<a href=/v1.2/zh/docs/examples/bookinfo/>Istio Bookinfo示例应用程序</a>,这是将书籍评级数据保存在 MySQL 数据库中的版本。你会在集群外部署此数据库并配置 <em>ratings</em> 服务以使用它,你还会定义<a href=https://archive.istio.io/v0.7/docs/reference/config/istio.routing.v1alpha1/#EgressRule>出口规则</a>以允许网内应用程序访问外部数据库。</p><h2 id=bookinfo-示例应用程序与外部评级数据库>Bookinfo 示例应用程序与外部评级数据库</h2><p>首先,在 Kubernetes 集群之外设置了一个 MySQL 数据库实例来保存 Bookinfo 评级数据,然后修改 <a href=/v1.2/zh/docs/examples/bookinfo/>Bookinfo 示例应用程序</a>以使用这个数据库。</p><h3 id=为评级数据设置数据库>为评级数据设置数据库</h3><p>为此,你设置了 <a href=https://www.mysql.com>MySQL</a> 的实例,你可以使用任何 MySQL 实例; 我使用 <a href=https://www.ibm.com/cloud/compose/mysql>Compose for MySQL</a>,我使用<code>mysqlsh</code><a href=https://dev.mysql.com/doc/mysql-shell/en/>MySQL Shell</a>)作为 MySQL 客户端来提供评级数据。</p><ol><li><p>设置 <code>MYSQL_DB_HOST</code><code>MYSQL_DB_PORT</code> 环境变量。</p><pre><code class=language-bash data-expandlinks=true>$ export MYSQL_DB_HOST=&lt;你的 MySQL host&gt;
$ export MYSQL_DB_PORT=&lt;你的 MySQL port&gt;
</code></pre><p>如果你使用的是本地数据库,使用的是默认 MYSQL port<code>host</code><code>port</code> 分别是 <code>localhost</code><code>3306</code></p></li><li><p>初始化数据库时,如果出现提示,执行下面的命令输入密码。这个命令通过 <code>admin</code> 数据库用户凭证来执行。这个 <code>admin</code> 用户是通过 <a href=https://www.ibm.com/cloud/compose/mysql>Compose for Mysql</a> 创建数据库时默认存在的。</p><pre><code class=language-bash data-expandlinks=true>$ curl -s https://raw.githubusercontent.com/istio/istio/release-1.2/samples/bookinfo/src/mysql/mysqldb-init.sql | mysqlsh --sql --ssl-mode=REQUIRED -u admin -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT
</code></pre><p><em><strong>或者</strong></em></p><p>使用<code>mysql</code>客户端和本地MySQL数据库时运行</p><pre><code class=language-bash data-expandlinks=true>$ curl -s https://raw.githubusercontent.com/istio/istio/release-1.2/samples/bookinfo/src/mysql/mysqldb-init.sql | mysql -u root -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT
</code></pre></li><li><p>创建一个名为 <code>bookinfo</code> 的用户,并在 <code>test.ratings</code> 表上授予它 <em>SELECT</em> 权限:</p><pre><code class=language-bash data-expandlinks=true>$ mysqlsh --sql --ssl-mode=REQUIRED -u admin -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT -e &#34;CREATE USER &#39;bookinfo&#39; IDENTIFIED BY &#39;&lt;password you choose&gt;&#39;; GRANT SELECT ON test.ratings to &#39;bookinfo&#39;;&#34;
</code></pre><p><em><strong>或者</strong></em></p><p>对于 <code>mysql</code> 和本地数据库,命令是:</p><pre><code class=language-bash data-expandlinks=true>$ mysql -u root -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT -e &#34;CREATE USER &#39;bookinfo&#39; IDENTIFIED BY &#39;&lt;password you choose&gt;&#39;; GRANT SELECT ON test.ratings to &#39;bookinfo&#39;;&#34;
</code></pre><p>在这里,你会应用<a href=https://en.wikipedia.org/wiki/Principle_of_least_privilege>最小特权原则</a>,这意味着不在 Bookinfo 应用程序中使用 <code>admin</code> 用户。相反,你为应用程序 Bookinfo 创建了一个最小权限的特殊用户 <code>bookinfo</code> 在这种情况下,<code>bookinfo</code> 用户只对单个表具有 <code>SELECT</code> 特权。</p><p>在运行命令创建用户之后,你可能会想通过检查最后一个命令的编号并运行 <code>history -d &lt;创建用户的命令编号&gt;</code> 来清理我的 bash 历史记录。你可能不希望新用户的密码存储在 bash 历史记录中,如果你使用了 <code>mysql</code> 命令行工具,记得要删除 <code>~/.mysql_history</code> 文件中的最后一个命令。在 <a href=https://dev.mysql.com/doc/refman/5.5/en/create-user.html>MySQL 文档</a>中阅读有关新创建用户的密码保护的更多信息。</p></li><li><p>检查创建的评级,看看一切都按预期工作:</p><pre><code class=language-bash data-expandlinks=true>$ mysqlsh --sql --ssl-mode=REQUIRED -u bookinfo -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT -e &#34;select * from test.ratings;&#34;
Enter password:
+----------+--------+
| ReviewID | Rating |
+----------+--------+
| 1 | 5 |
| 2 | 4 |
+----------+--------+
</code></pre><p><em><strong>或者</strong></em></p><p>对于 <code>mysql</code> 和本地数据库:</p><pre><code class=language-bash data-expandlinks=true>$ mysql -u bookinfo -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT -e &#34;select * from test.ratings;&#34;
Enter password:
+----------+--------+
| ReviewID | Rating |
+----------+--------+
| 1 | 5 |
| 2 | 4 |
+----------+--------+
</code></pre></li><li><p>暂时将评级设置为<code>1</code>,以便在 Bookinfo <em>ratings</em> 服务使用我们的数据库时提供可视线索:</p><pre><code class=language-bash data-expandlinks=true>$ mysqlsh --sql --ssl-mode=REQUIRED -u admin -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT -e &#34;update test.ratings set rating=1; select * from test.ratings;&#34;
Enter password:
Rows matched: 2 Changed: 2 Warnings: 0
+----------+--------+
| ReviewID | Rating |
+----------+--------+
| 1 | 1 |
| 2 | 1 |
+----------+--------+
</code></pre><p><em><strong></strong></em></p><p>对于<code>mysql</code>和本地数据库:</p><pre><code class=language-bash data-expandlinks=true>$ mysql -u root -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT -e &#34;update test.ratings set rating=1; select * from test.ratings;&#34;
Enter password:
+----------+--------+
| ReviewID | Rating |
+----------+--------+
| 1 | 1 |
| 2 | 1 |
+----------+--------+
</code></pre><p>在最后一个命令中使用了 <code>admin</code> 用户(和 <code>root</code> 用于本地数据库),因为 <code>bookinfo</code> 用户在 <code>test.ratings</code> 表上没有 <code>UPDATE</code> 权限。</p></li></ol><p>现在你已经可以去部署使用外部数据库的 Bookinfo 应用程序版本了。</p><h3 id=bookinfo-应用程序的初始设置>Bookinfo 应用程序的初始设置</h3><p>为了演示使用外部数据库的场景,你首先使用安装了 <a href=/v1.2/zh/docs/setup/kubernetes/install/kubernetes/#安装步骤>Istio</a> 的 Kubernetes 集群,然后部署了 <a href=/v1.2/zh/docs/examples/bookinfo/>Istio Bookinfo示例应用程序</a>,还<a href=/v1.2/docs/examples/bookinfo/#apply-default-destination-rules>应用了默认的 destination rule</a></p><p>此应用程序使用 <code>ratings</code> 微服务来获取书籍评级评分在1到5之间。评级显示为每个评论的星号有几个版本的 <code>ratings</code> 微服务。有些人使用 <a href=https://www.mongodb.com>MongoDB</a>,有些使用 <a href=https://www.mysql.com>MySQL</a> 作为他们的数据库。</p><p>这篇博客例子里的命令是以 Istio 0.8 以上版本为基础的,无论启用或不启用<a href=/v1.2/zh/docs/concepts/security/#双向-tls-认证>双向 TLS</a></p><p>提醒一下,这是 <a href=/v1.2/zh/docs/examples/bookinfo/>Bookinfo 示例应用程序</a>中应用程序的原始整体架构图。</p><figure style=width:80%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:59.086918235567985%><a data-skipendnotes=true href=/v1.2/docs/examples/bookinfo/withistio.svg title="原始的 Bookinfo 应用程序"><img class=element-to-stretch src=/v1.2/docs/examples/bookinfo/withistio.svg alt="原始的 Bookinfo 应用程序"></a></div><figcaption>原始的 Bookinfo 应用程序</figcaption></figure><h3 id=将数据库用于-bookinfo-应用程序中的评级数据>将数据库用于 Bookinfo 应用程序中的评级数据</h3><ol><li><p>修改使用 MySQL 数据库的 <em>ratings</em> 服务版本的 <code>deployment spec</code>,以使用你的数据库实例。该 <code>spec</code> 位于 Istio 发行档案的<a href=https://github.com/istio/istio/blob/release-1.2/samples/bookinfo/platform/kube/bookinfo-ratings-v2-mysql.yaml><code>samples/bookinfo/platform/kube/bookinfo-ratings-v2-mysql.yaml</code></a>中。编辑以下几行:</p><pre><code class=language-yaml data-expandlinks=true>- name: MYSQL_DB_HOST
value: mysqldb
- name: MYSQL_DB_PORT
value: &#34;3306&#34;
- name: MYSQL_DB_USER
value: root
- name: MYSQL_DB_PASSWORD
value: password
</code></pre><p>替换上面代码段中的值,指定数据库主机,端口,用户和密码,请注意,在 Kubernetes 中使用容器环境变量中密码的正确方法是<a href=https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables>使用 secret</a>,仅对于此示例任务,你可能会在 deployment spec 中直接配置明文的密码, <strong>切记!不要在真实环境中这样做</strong>!我想你们应该也知道,<code>&quot;password&quot;</code> 这个值也不应该用作密码。</p></li><li><p>应用修改后的 <code>spec</code> 来部署使用外部数据库的 <em>ratings</em> 服务,<em>v2-mysql</em> 的版本。</p><div><a data-skipendnotes=true style=display:none href=https://raw.githubusercontent.com/istio/istio/release-1.2/samples/bookinfo/platform/kube/bookinfo-ratings-v2-mysql.yaml>Zip</a><pre><code class=language-bash data-expandlinks=true>$ kubectl apply -f @samples/bookinfo/platform/kube/bookinfo-ratings-v2-mysql.yaml@
deployment &#34;ratings-v2-mysql&#34; created
</code></pre></div></li><li><p>将发往 <em>reviews</em> 服务的所有流量路由到 <em>v3</em> 版本,这样做是为了确保 <em>reviews</em> 服务始终调用 <em>ratings</em> 服务,此外,将发往 <em>ratings</em> 服务的所有流量路由到使用外部数据库的 _ratings v2-mysql_。</p><p>通过添加两个<a href=/v1.2/zh/docs/reference/config/istio.networking.v1alpha3/#VirtualService>虚拟服务(virtual service)</a>,可以为上述两种服务指定路由。这些虚拟服务在 Istio 发行档案的 <code>samples/bookinfo/networking/virtual-service-ratings-mysql.yaml</code> 中指定。
<strong><em>注意:</em></strong>确保你在完成了<a href=/v1.2/docs/examples/bookinfo/#apply-default-destination-rules>添加默认目标路由</a>才执行下面的命令。</p><div><a data-skipendnotes=true style=display:none href=https://raw.githubusercontent.com/istio/istio/release-1.2/samples/bookinfo/networking/virtual-service-ratings-mysql.yaml>Zip</a><pre><code class=language-bash data-expandlinks=true>$ kubectl apply -f @samples/bookinfo/networking/virtual-service-ratings-mysql.yaml@
</code></pre></div></li></ol><p>更新的架构如下所示,请注意,网格内的蓝色箭头标记根据我们添加的虚拟服务配置的流量,根据虚拟服务的定义,流量将发送到 <em>reviews v3</em><em>ratings v2-mysql</em></p><figure style=width:80%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:59.314858206480224%><a data-skipendnotes=true href=/v1.2/blog/2018/egress-tcp/bookinfo-ratings-v2-mysql-external.svg title="Bookinfo 应用程序,其评级为 v2-mysql外部为 MySQL 数据库"><img class=element-to-stretch src=/v1.2/blog/2018/egress-tcp/bookinfo-ratings-v2-mysql-external.svg alt="Bookinfo 应用程序,其评级为 v2-mysql外部为 MySQL 数据库"></a></div><figcaption>Bookinfo 应用程序,其评级为 v2-mysql外部为 MySQL 数据库</figcaption></figure><p>请注意MySQL 数据库位于 Istio 服务网格之外,或者更准确地说是在 Kubernetes 集群之外,服务网格的边界由虚线标记。</p><h3 id=访问网页>访问网页</h3><p><a href=/v1.2/zh/docs/examples/bookinfo/#确定-ingress-的-ip-和端口>确定入口 IP 和端口</a>之后,访问应用程序的网页。</p><p>你会发现问题,在每次审核下方都会显示消息 <em>&ldquo;Ratings service is currently unavailable”</em> 而不是评级星标。</p><figure style=width:80%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:36.18705035971223%><a data-skipendnotes=true href=/v1.2/blog/2018/egress-tcp/errorFetchingBookRating.png title="Ratings 服务的错误信息"><img class=element-to-stretch src=/v1.2/blog/2018/egress-tcp/errorFetchingBookRating.png alt="Ratings 服务的错误信息"></a></div><figcaption>Ratings 服务的错误信息</figcaption></figure><p><a href=/v1.2/zh/blog/2018/egress-https/>使用外部Web服务</a>一样,你会体验到<strong>优雅的服务降级</strong>,这很好,虽然 <em>ratings</em> 服务中有错误,但是应用程序并没有因此而崩溃,应用程序的网页正确显示了书籍信息,详细信息和评论,只是没有评级星。</p><p>你遇到的问题与<a href=/v1.2/zh/blog/2018/egress-https/>使用外部Web服务</a>中的问题相同,即 Kubernetes 集群外的所有流量TCP和HTTP都被 sidecar 代理默认阻止,要为 TCP 启用此类流量,必须定义 TCP 的网格外部服务入口。</p><h3 id=外部-mysql-实例的网格外部服务入口>外部 MySQL 实例的网格外部服务入口</h3><p>&ldquo;TCP 网格外部服务入口&rdquo;功能可以解决上面的问题。</p><ol><li><p>获取你的 MySQL 数据库事例的 IP 地址,作为参考,你可以通过 <a href=https://linux.die.net/man/1/host>host</a> 命令实现:</p><pre><code class=language-bash data-expandlinks=true>$ export MYSQL_DB_IP=$(host $MYSQL_DB_HOST | grep &#34; has address &#34; | cut -d&#34; &#34; -f4)
</code></pre><p>如果是本地数据库,设置 <code>MYSQL_DB_IP</code> 环境变量为你的本机IP保证这个环境变量能被集群访问到。</p></li><li><p>定义一个网格外部服务入口:</p><pre><code class=language-bash data-expandlinks=true>$ kubectl apply -f - &lt;&lt;EOF
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: mysql-external
spec:
hosts:
- $MYSQL_DB_HOST
addresses:
- $MYSQL_DB_IP/32
ports:
- name: tcp
number: $MYSQL_DB_PORT
protocol: tcp
location: MESH_EXTERNAL
EOF
</code></pre></li><li><p>检查你刚刚新增的服务入口,确保它的值是正确的</p><pre><code class=language-bash data-expandlinks=true>$ kubectl get serviceentry mysql-external -o yaml
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
...
</code></pre></li></ol><p>请注意,对于 TCP 服务入口,将 <code>tcp</code> 指定为入口 &ldquo;port&rdquo;&ldquo;protocol&rdquo; 的值,另请注意,要在 &ldquo;addresses&rdquo; 列表里面指定外部服务的 IP 地址,作为一个 <code>32</code> 为后缀的 <a href=https://tools.ietf.org/html/rfc2317>CIDR</a> 块。</p><p><a href=#tcp-流量的服务入口>下面</a>我将详细讨论 TCP 服务入口。现在先来验证我们添加的出口规则是否解决了问题。访问网页看看评星是否回来了。</p><p>有效! 访问应用程序的网页会显示评级而不会出现错误:</p><figure style=width:80%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:36.69064748201439%><a data-skipendnotes=true href=/v1.2/blog/2018/egress-tcp/externalMySQLRatings.png title="Book Ratings 显示正常"><img class=element-to-stretch src=/v1.2/blog/2018/egress-tcp/externalMySQLRatings.png alt="Book Ratings 显示正常"></a></div><figcaption>Book Ratings 显示正常</figcaption></figure><p>请注意,正如预期的那样,你会看到两个显示评论的一星评级。将评级更改为一颗星,为我们提供了一个视觉线索,确实使用了我们的外部数据库。</p><p>与 HTTP/HTTPS 的服务入口一样,你可以动态地使用 <code>kubectl</code> 删除和创建 TCP 的服务入口。</p><h2 id=出口-tcp-流量控制的动机>出口 TCP 流量控制的动机</h2><p>一些网内 Istio 应用程序必须访问外部服务,例如遗留系统,在许多情况下,不通过 HTTP 或 HTTPS 协议执行访问,使用其他 TCP 协议,例如 <a href=https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/>MongoDB wire 协议</a><a href=https://dev.mysql.com/doc/internals/en/client-server-protocol.html>MySQL客户端/服务器协议</a>等特定于数据库的协议,与外部数据库通信。</p><p>接下来我会再说说 TCP 流量的服务入口。</p><h2 id=tcp-流量的服务入口>TCP 流量的服务入口</h2><p>启用到特定端口的 TCP 流量的服务入口必须指定 <code>TCP</code> 作为端口的协议,此外,对于 <a href=https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/>MongoDB wire协议</a>,协议可以指定为 <code>MONGO</code>,而不是 <code>TCP</code></p><p>对于服务入口配置的 <code>addresses</code> 字段,必须使用 <a href=https://tools.ietf.org/html/rfc2317>CIDR</a>表示法中的 IP 块。注意在 TCP 服务入口配置中,<code>host</code> 字段会被忽略。</p><p>要通过其主机名启用到外部服务的 TCP 流量,必须指定主机名的所有 IP每个 IP 必须由 CIDR 块指定。</p><p>请注意,外部服务的所有 IP 并不总是已知。要往外发送 TCP 流量,只能配置为被应用程序使用的 IP。</p><p>另请注意,外部服务的 IP 并不总是静态的,例如在 <a href=https://en.wikipedia.org/wiki/Content_delivery_network>CDNs</a> 的情况下,有时 IP 在大多数情况下是静态的,但可以不时地更改,例如由于基础设施的变化。在这些情况下,如果已知可能 IP 的范围,则应通过 CIDR 块指定范围。如果不知道可能的IP的范围则不能使用 TCP 服务入口,并且<a href=/v1.2/zh/docs/tasks/traffic-management/egress/#直接调用外部服务>必须直接调用外部服务</a>,绕过 sidecar 代理。</p><h2 id=与网格扩展的关系>与网格扩展的关系</h2><p>请注意,本文中描述的场景与<a href=/v1.2/zh/docs/examples/integrating-vms/>集成虚拟机</a>示例中描述的网格扩展场景不同。 在这种情况下MySQL 实例在与 Istio 服务网格集成的外部集群外机器裸机或VM上运行 MySQL 服务成为网格的一等公民,具有 Istio 的所有有益功能,除此之外,服务可以通过本地集群域名寻址,例如通过 <code>mysqldb.vm.svc.cluster.local</code>,并且可以通过<a href=/v1.2/zh/docs/concepts/security/#双向-tls-认证>双向 TLS 身份验证</a>保护与它的通信,无需创建服务入口来访问此服务; 但是,该服务必须在 Istio 注侧,要启用此类集成,必须在计算机上安装 Istio 组件( <em>Envoy proxy</em> <em>node-agent</em> <code>_istio-agent_</code> ),并且必须可以从中访问 Istio 控制平面(<em>Pilot</em> <em>Mixer</em> <em>Citadel</em> )。有关详细信息,请参阅 <a href=/v1.2/zh/docs/setup/kubernetes/additional-setup/mesh-expansion/>Istio Mesh Expansion</a> 说明。</p><p>在我们的示例中MySQL 实例可以在任何计算机上运行,也可以由云提供商作为服务进行配置,无需集成机器
与 Istio ,无需从机器访问 Istio 控制平面,在 MySQL 作为服务的情况下MySQL 运行的机器可能无法访问并在其上安装所需的组件可能是不可能的在我们的例子中MySQL 实例可以通过其全局域名进行寻址,如果消费应用程序希望使用该域名,这可能是有益的,当在消费应用程序的部署配置中无法更改预期的域名时,这尤其重要。</p><h2 id=清理>清理</h2><ol><li><p>删除 <code>test</code> 数据库和 <code>bookinfo</code> 用户:</p><pre><code class=language-bash data-expandlinks=true>$ mysqlsh --sql --ssl-mode=REQUIRED -u admin -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT -e &#34;drop database test; drop user bookinfo;&#34;
</code></pre><p><em><strong>或者</strong></em></p><p>对于<code>mysql</code>和本地数据库:</p><pre><code class=language-bash data-expandlinks=true>$ mysql -u root -p --host $MYSQL_DB_HOST --port $MYSQL_DB_PORT -e &#34;drop database test; drop user bookinfo;&#34;
</code></pre></li><li><p>删除虚拟服务:</p><div><a data-skipendnotes=true style=display:none href=https://raw.githubusercontent.com/istio/istio/release-1.2/samples/bookinfo/networking/virtual-service-ratings-mysql.yaml>Zip</a><pre><code class=language-bash data-expandlinks=true>$ kubectl delete -f @samples/bookinfo/networking/virtual-service-ratings-mysql.yaml@
Deleted config: virtual-service/default/reviews
Deleted config: virtual-service/default/ratings
</code></pre></div></li><li><p>取消部署 <em>ratings v2-mysql</em> </p><div><a data-skipendnotes=true style=display:none href=https://raw.githubusercontent.com/istio/istio/release-1.2/samples/bookinfo/platform/kube/bookinfo-ratings-v2-mysql.yaml>Zip</a><pre><code class=language-bash data-expandlinks=true>$ kubectl delete -f @samples/bookinfo/platform/kube/bookinfo-ratings-v2-mysql.yaml@
deployment &#34;ratings-v2-mysql&#34; deleted
</code></pre></div></li><li><p>删除服务入口:</p><pre><code class=language-bash data-expandlinks=true>$ kubectl delete serviceentry mysql-external -n default
Deleted config: serviceentry mysql-external
</code></pre></li></ol><h2 id=结论>结论</h2><p>在这篇博文中,我演示了 Istio 服务网格中的微服务如何通过 TCP 使用外部服务默认情况下Istio 会阻止所有流量TCP 和 HTTP到集群外的主机 要为 TCP 启用此类流量,必须为服务网格创建 TCP 网格外部服务入口。</p><nav id=see-also><h2>相关内容</h2><div class=see-also><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/blog/2018/egress-mongo/>使用外部 MongoDB 服务</a></p><p class=desc>描述了一个基于 Istio 的 Bookinfo 示例的简单场景。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/blog/2019/egress-performance/>Egress gateway 性能测试</a></p><p class=desc>评估加入 Egress gateway 对性能造成的影响。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/blog/2018/egress-monitoring-access-control/>HTTP Egress 流量监控和访问策略</a></p><p class=desc>描述如何配置 Istio 进行 HTTP Egress 流量监控和访问策略。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/blog/2018/egress-https/>使用外部 Web 服务</a></p><p class=desc>描述基于 Istio Bookinfo 示例的简单场景。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/docs/tasks/traffic-management/edge-traffic/egress_sni_monitoring_and_policies/>Egress TLS 流量中的 SNI 监控及策略</a></p><p class=desc>如何为 Egress TLS 流量配置 SNI 监控并应用策略。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.2/zh/docs/tasks/traffic-management/edge-traffic/egress-gateway-tls-origination/>Egress 网关的 TLS 发起过程</a></p><p class=desc>描述了配置 Egress 网关来发起对外部服务进行 TLS 通信的过程。</p></div></div></nav></article><nav class=pagenav><div class=left><a title=介绍更安全,低风险的部署和发布到生产。 href=/v1.2/zh/blog/2018/traffic-mirroring/><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#left-arrow"/></svg>用于在生产环境进行测试的 Istio 流量镜像功能</a></div><div class=right><a title="描述基于 Istio Bookinfo 示例的简单场景。" href=/v1.2/zh/blog/2018/egress-https/>使用外部 Web 服务<svg class="icon"><use xlink:href="/v1.2/img/icons.svg#right-arrow"/></svg></a></div></nav><div id=endnotes-container aria-hidden=true><h2>链接</h2><ol id=endnotes></ol></div></div><div class=toc-container><nav class=toc aria-label="Table of Contents"><div id=toc><ol><li role=none aria-label="Bookinfo 示例应用程序与外部评级数据库"><a href=#bookinfo-%e7%a4%ba%e4%be%8b%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e4%b8%8e%e5%a4%96%e9%83%a8%e8%af%84%e7%ba%a7%e6%95%b0%e6%8d%ae%e5%ba%93>Bookinfo 示例应用程序与外部评级数据库</a><ol><li role=none aria-label=为评级数据设置数据库><a href=#%e4%b8%ba%e8%af%84%e7%ba%a7%e6%95%b0%e6%8d%ae%e8%ae%be%e7%bd%ae%e6%95%b0%e6%8d%ae%e5%ba%93>为评级数据设置数据库</a><li role=none aria-label="Bookinfo 应用程序的初始设置"><a href=#bookinfo-%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e7%9a%84%e5%88%9d%e5%a7%8b%e8%ae%be%e7%bd%ae>Bookinfo 应用程序的初始设置</a><li role=none aria-label="将数据库用于 Bookinfo 应用程序中的评级数据"><a href=#%e5%b0%86%e6%95%b0%e6%8d%ae%e5%ba%93%e7%94%a8%e4%ba%8e-bookinfo-%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e4%b8%ad%e7%9a%84%e8%af%84%e7%ba%a7%e6%95%b0%e6%8d%ae>将数据库用于 Bookinfo 应用程序中的评级数据</a><li role=none aria-label=访问网页><a href=#%e8%ae%bf%e9%97%ae%e7%bd%91%e9%a1%b5>访问网页</a><li role=none aria-label="外部 MySQL 实例的网格外部服务入口"><a href=#%e5%a4%96%e9%83%a8-mysql-%e5%ae%9e%e4%be%8b%e7%9a%84%e7%bd%91%e6%a0%bc%e5%a4%96%e9%83%a8%e6%9c%8d%e5%8a%a1%e5%85%a5%e5%8f%a3>外部 MySQL 实例的网格外部服务入口</a></ol></li><li role=none aria-label="出口 TCP 流量控制的动机"><a href=#%e5%87%ba%e5%8f%a3-tcp-%e6%b5%81%e9%87%8f%e6%8e%a7%e5%88%b6%e7%9a%84%e5%8a%a8%e6%9c%ba>出口 TCP 流量控制的动机</a><li role=none aria-label="TCP 流量的服务入口"><a href=#tcp-%e6%b5%81%e9%87%8f%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%85%a5%e5%8f%a3>TCP 流量的服务入口</a><li role=none aria-label=与网格扩展的关系><a href=#%e4%b8%8e%e7%bd%91%e6%a0%bc%e6%89%a9%e5%b1%95%e7%9a%84%e5%85%b3%e7%b3%bb>与网格扩展的关系</a><li role=none aria-label=清理><a href=#%e6%b8%85%e7%90%86>清理</a><li role=none aria-label=结论><a href=#%e7%bb%93%e8%ae%ba>结论</a><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol></div></nav></div></main><footer><div class=user-links><a class=channel title="Go download Istio 1.2.5 now" href=https://github.com/istio/istio/releases/tag/1.2.5 aria-label="Download Istio"><span>download</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#download"/></svg>
</a><a class=channel title="加入 Istio discussion board 参与讨论获取帮助" href=https://discuss.istio.io aria-label="Istio discussion board"><span>discuss</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#discourse"/></svg></a>
<a class=channel title="Stack Overflow 中列举了针对实际问题以及部署、配置和使用 Istio 的各项回答" href=https://stackoverflow.com/questions/tagged/istio aria-label="Stack Overflow"><span>stack overflow</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#stackoverflow"/></svg></a>
<a class=channel title="在 Slack 上与 Istio 社区交互讨论开发问题(仅限邀请)" href=https://istio.slack.com aria-label=slack><span>slack</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#slack"/></svg></a>
<a class=channel title="关注我们的 Twitter 来获取最新信息" href=https://twitter.com/IstioMesh aria-label=Twitter><span>twitter</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#twitter"/></svg></a><div class=tag>对于用户</div></div><div class=info><p class=copyright>中文内容由 ServiceMesher 社区维护,部分文档可能稍微滞后于英文版本,同步工作持续进行中<br>Istio 归档
1.2.5<br>&copy; 2019 Istio Authors, <a href=https://policies.google.com/privacy>隐私政策</a><br>归档于 2019年9月12日</p></div><div class=dev-links><a class=channel title="Istio 的代码在 GitHub 上开发" href=https://github.com/istio/community aria-label=GitHub><span>github</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#github"/></svg></a>
<a class=channel title="如果您想深入了解 Istio 的技术细节,请查看我们日益完善的设计文档" href=https://groups.google.com/forum/#!forum/istio-team-drive-access aria-label="team drive"><span>drive</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#drive"/></svg></a>
<a class=channel title="如果您想为 Istio 项目做出贡献,请考虑加入我们的工作组" href=https://github.com/istio/community/blob/master/WORKING-GROUPS.md aria-label="working groups"><span>working groups</span><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#working-groups"/></svg></a><div class=tag>对于开发者</div></div></footer><div id=scroll-to-top-container aria-hidden=true><button id=scroll-to-top title=回到顶部><svg class="icon"><use xlink:href="/v1.2/img/icons.svg#top"/></svg></button></div></body></html>