电子发烧友网 > 今日头条 > 正文

下载达 10 万次的 IDEA 插件,K8s 一键部署了解一下?

2019年11月14日 23:06 次阅读
<p><span data-offset-key="cvmd9-0-0">作者 | 铃儿响叮当</span></p><blockquote class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="2gotb-0-0" style="margin: 1.4em 0px; padding-left: 1em; color: rgb(100, 100, 100); border-left: 3px solid rgb(211, 211, 211); font-family: -apple-system, BlinkMacSystemFont, &quot;HelveTIca Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="2gotb-0-0" style="font-weight: bold;">导读</span><span data-offset-key="2gotb-0-1">:涉及开发的技术人员,永远绕不开的就是将应用部署到相应服务器上,本文将给大家讲解:对于容器服务 ACK,怎么实现真正“一键部署”,提高开发部署效率,在 K8s 的运用上做到快人一步。</span></p></blockquote><p><span data-offset-key="33o1j-0-0">随着互联网时代的不断发展,开发者可能会面临这样的困境:为了解决问题、提升开发效率而竭力研发出来的“创新”,似乎削弱了他们在公司的重要程度,甚至取代了他们原先的地位。</span></p><p><span data-offset-key="4n7ci-0-0">比如,在云原生时代,部分企业更愿意选择 K8s 来解决运维、弹性的问题,而不是组建一支需要耗费大量雇佣资金、管理资金的研发团队。</span></p><p><span data-offset-key="5ojn6-0-0">对于 K8s,它的价值在于不仅能帮助公司降低运维成本,同时还可以带来弹性、敏捷、可移植能力。</span></p><p><span data-offset-key="efcu9-0-0">但是对于开发者而言,我们的价值不应该仅仅停留在能与 K8s 解决同样的问题,而是从困境跳脱出来,思考如何更灵活、更高效地运用 K8s 这些 “能为你所用” 的东西,来提升自己的综合技能。</span></p><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="f014l-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;HelveTIca Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="f014l-0-0">什么是容器服务 ACK</span></p></h2><p><span data-offset-key="1mgis-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="6ufjl-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;HelveTIca Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/FE/pIYBAF3Dz3OAY5JNAACIkN1N9HA576.jpg" data-size="normal" data-rawwidth="1025" data-rawheight="418" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dzz2AO6_MAADzXhyBeLQ771.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dzz2AaVvSAAECs5WvC_o266.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="2d85q-0-0"><br data-text="true"/></span></p><p><span data-offset-key="evgpg-0-0"><span data-text="true">容器服务 ACK 是基于原生 K8s 进行适配和增强,简化集群的搭建和扩容等工作,提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理,整合阿里云虚拟化、存储、网络和安全能力,打造云端最佳容器化应用运行环境。</span></span></p><p><span data-offset-key="1vdo7-0-0"><span data-text="true">其中的核心功能为:</span></span></p><ul class="public-DraftStyleDefault-ul list-paddingleft-2" data-offset-key="165ma-0-0" style="padding: 0px; margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;HelveTIca Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><li><p><span data-offset-key="165ma-0-0" style="font-weight: bold;"><span data-text="true">集群管理</span></span><span data-offset-key="165ma-0-1"><span data-text="true">:灵活的地域和网络环境选择,可以根据自己的需求,选择不同的地域创建和删除集群;</span></span></p></li><li><p><span data-offset-key="71fi9-0-0" style="font-weight: bold;"><span data-text="true">多种服务器托管方式</span></span><span data-offset-key="71fi9-0-1"><span data-text="true">:支持授权容器服务创建云服务器加入到指定集群,支持将已购买的云服务器添加到指定集群;</span></span></p></li><li><p><span data-offset-key="p1i6-0-0" style="font-weight: bold;"><span data-text="true">一站式容器生命周期管理</span></span><span data-offset-key="p1i6-0-1"><span data-text="true">:包括网络、存储、日志、监控、调度、路由、权限;</span></span></p></li><li><p><span data-offset-key="epkpj-0-0" style="font-weight: bold;"><span data-text="true">灵活扩展调度策略,轻松打通上下游交付流程</span></span><span data-offset-key="epkpj-0-1"><span data-text="true">:支持服务级别的亲和性策略和横向扩展、跨 AZ 高可用和灾难恢复、集群和应用管理的 OpenAPI,轻松对接持续集成和私有部署系统。</span></span></p></li></ul><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="b5ccg-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="b5ccg-0-0"><span data-text="true">如何实现“一键部署”到容器服务 ACK</span></span></p></h2><p><span data-offset-key="cktqo-0-0"><span data-text="true">提高开发部署的效率有很多种方法,今天给大家分享的是一款本地 IDE 插件 —— </span></span><a data-offset-key="cktqo-1-0" data-editable="true" target="_blank" href="https://yq.aliyun.com/go/articleRenderRedirect?url=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NzU0MDIzOQ%3D%3D%26amp%3Bmid%3D2247486886%26amp%3Bidx%3D1%26amp%3Bsn%3D0e40b72351c8e2d1ea1d56bea2e05d92%26amp%3Bchksm%3Dfdeb3fc6ca9cb6d0110b32acdc3175823ee7be39eea94aee2f3d279a3347e7a109d0e800a1cb%26amp%3Bscene%3D21%23wechat_redirect" class="Link ztext-link" style="text-decoration-line: none; cursor: pointer; border-bottom: 1px solid grey;"><span data-offset-key="cktqo-1-0" style="font-weight: bold;"><span data-text="true">Cloud Toolkit</span></span></a><span data-offset-key="cktqo-2-0"><span data-text="true">,据说是开发者用得最多的插件之一。</span></span></p><p><span data-offset-key="339ou-0-0"><span data-text="true">它不仅能够将代码开发到最终部署这整个流程自动化,更是可以部署到任意服务器 &amp; 云端(ECS、EDAS、K8s 和小程序云等),而且附带很多功能:Arthas 诊断、Dubbo 工具、Terminal 终端、文件上传和 MySQL 执行器等,最重要的一点是:</span></span><span data-offset-key="339ou-0-1" style="font-weight: bold;"><span data-text="true">免费!免费!免费!</span></span><span data-offset-key="339ou-0-2"><span data-text="true">网上很多博客、技术网站、公众号都有相关的测评,大家可以参考看看,或者自己安装试用,一定要试用</span></span><span data-offset-key="339ou-0-3" style="font-weight: bold;"><span data-text="true">【一键部署】</span></span><span data-offset-key="339ou-0-4"><span data-text="true">的功能!</span></span></p><p><span data-offset-key="cts5s-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="f8ocb-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/FE/pIYBAF3Dz3SASxZ9AAA3wdJ8Odo817.jpg" data-size="normal" data-rawwidth="604" data-rawheight="273" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/FE/pIYBAF3Dz3WAOiEDAAA3u197X1Y845.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dzz6ABvQjAAA5eHckcAQ489.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="d82he-0-0"><br data-text="true"/></span></p><p><span data-offset-key="aebkd-0-0"><span data-text="true">下面介绍,如何借助这个插件,将应用一键部署到容器服务 ACK 上。</span></span></p><p><span data-offset-key="dsv2m-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="duns8-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dzz6AS_UHAABaqd9sN0A643.jpg" data-size="normal" data-rawwidth="1080" data-rawheight="463" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/FE/pIYBAF3Dz3uAPw8vAACdxge237A209.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/FE/pIYBAF3Dz3yAZECKAACwx0DopRM412.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="9k3eg-0-0"><br data-text="true"/></span></p><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="52gdi-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="52gdi-0-0"><span data-text="true">(一)安装插件</span></span></p></h2><p><span data-offset-key="7kv8q-0-0" style="font-weight: bold;"><span data-text="true"> 点击链接即可免费下载插件:</span></span><a data-offset-key="7kv8q-1-0" data-editable="true" target="_blank" href="https://www.aliyun.com/product/cloudtoolkit" class="Link ztext-link" style="text-decoration-line: none; cursor: pointer; border-bottom: 1px solid grey;"><span data-offset-key="7kv8q-1-0"><span data-text="true">https://www.aliyun.com/product/cloudtoolkit</span></span></a></p><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="1vf2k-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="1vf2k-0-0"><span data-text="true">(二)配置插件首选项</span></span></p></h2><p><span data-offset-key="3l0tg-0-0" style="font-weight: bold;"><span data-text="true">点击</span></span><span data-offset-key="3l0tg-0-1"><span data-text="true">:顶部菜单 Tools --&gt; Alibaba Cloud Toolkit --&gt; Preferences--&gt; 左边列表的 Alibaba Cloud Toolkit--&gt; Accounts 。</span></span></p><p><span data-offset-key="a420l-0-0"><span data-text="true">出现如下界面,配置阿里云账号的 AK 和 SK,即可完成首选项配置。(如果是子账号,则填写子账号的 AK 和 SK)</span></span></p><p><span data-offset-key="b37vc-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="f9mbc-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0WASIm-AAB_PF0joYE132.jpg" data-size="normal" data-rawwidth="861" data-rawheight="674" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0aAGcW-AACxf6pn-RA442.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/FE/pIYBAF3Dz32AcBehAAC-7wLvEf8967.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="7pj2p-0-0"><br data-text="true"/></span></p><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="5rkle-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="5rkle-0-0"><span data-text="true">(三)设置本地 Docker 镜像打包</span></span></p></h2><p><span data-offset-key="8lif3-0-0" style="font-weight: bold;"><span data-text="true">点击:</span></span><span data-offset-key="8lif3-0-1"><span data-text="true">顶部菜单 Tools --&gt; Alibaba Cloud Toolkit --&gt; Preferences --&gt; 左边列表的 Alibaba Cloud Toolkit --&gt; Docker。</span></span></p><p><span data-offset-key="fqivv-0-0"><span data-text="true">如下图,设置本地 Docker 镜像打包。</span></span></p><p><span data-offset-key="3d8qj-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="9eo47-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/FE/pIYBAF3Dz32ATRVxAAC5i1k5lrg276.jpg" data-size="normal" data-rawwidth="743" data-rawheight="668" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0eAAu8UAADTU1aZfhg234.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0eAS8eFAADiOj6VjcU210.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="576bc-0-0"><br data-text="true"/></span></p><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="ceh7p-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="ceh7p-0-0"><span data-text="true">(四)部署应用</span></span></p></h2><p><span data-offset-key="2lfvr-0-0"><span data-text="true">在 Intellij IDEA 中,鼠标右键项目工程名,在出现的菜单中点击 Alibaba Cloud --&gt; Deploy to CS Kubernetes,出现如下部署窗口:</span></span></p><h3 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="m7f3-0-0" style="margin: 1.90909em 0px 1.27273em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.1em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="m7f3-0-0"><span data-text="true">第一步:设置 Image</span></span></p></h3><p><span data-offset-key="8dd3g-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="87o8g-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/FF/pIYBAF3Dz36Aek0MAABuwSUw1Uc152.jpg" data-size="normal" data-rawwidth="854" data-rawheight="666" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/FF/pIYBAF3Dz3-AYT0AAACWdGVI7Vc686.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0iASXa6AACjUhQD4LE690.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="elvd4-0-0"><br data-text="true"/></span></p><ul class="public-DraftStyleDefault-ul list-paddingleft-2" data-offset-key="4mkjf-0-0" style="padding: 0px; margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><li><p><span data-offset-key="4mkjf-0-0"><span data-text="true">在 Image 标签页中,选择本地应用程序的 Context Directory 和 Dockerfile (通常会根据您本地的应用工程自动识别并设置);</span></span></p></li><li><p><span data-offset-key="7uu31-0-0"><span data-text="true">选择容器镜像服务 ACR 的地域、命名空间和镜像仓库,然后单击 Container 标签页。</span></span></p></li></ul><p><span data-offset-key="92gsv-0-0" style="font-weight: bold;"><span data-text="true">说明</span></span><span data-offset-key="92gsv-0-1"><span data-text="true">:如果您还没有镜像仓库,在对话框右上角单击 Create a new repository 跳转到容器镜像仓库创建镜像仓库,创建步骤请参考容器镜像仓库文档。</span></span></p><h3 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="b6m9s-0-0" style="margin: 1.90909em 0px 1.27273em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.1em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="b6m9s-0-0"><span data-text="true">第二步:设置 Container</span></span></p></h3><p><span data-offset-key="b0np-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="fh61u-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0mAXnw9AAC525-Cfg0980.jpg" data-size="normal" data-rawwidth="742" data-rawheight="673" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/FF/pIYBAF3Dz4CAOxvZAADN8fWpbaQ909.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/FF/pIYBAF3Dz4CADmsdAADcSYBFInE741.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="1gs1d-0-0"><br data-text="true"/></span></p><ul class="public-DraftStyleDefault-ul list-paddingleft-2" data-offset-key="24smt-0-0" style="padding: 0px; margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><li><p><span data-offset-key="24smt-0-0"><span data-text="true">在 Container 标签页,选择容器服务 ACK 的 Deployment(部署)、Clusters(集群)和 Namespace(命名空间);</span></span></p></li><li><p><span data-offset-key="a37ch-0-0"><span data-text="true">选择指定的 Container(容器)。</span></span></p></li></ul><p><span data-offset-key="a3828-0-0" style="font-weight: bold;"><span data-text="true">说明</span></span><span data-offset-key="a3828-0-1"><span data-text="true">:如果您还没有创建容器服务 ACK 的 Deployment,在对话框右上角单击 Create a new Kubernetes deployment,跳转到容器服务 ACK 控制台创建 Deployment,创建步骤请参考容器服务 ACK 版文档。</span></span></p><h3 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="uiok-0-0" style="margin: 1.90909em 0px 1.27273em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.1em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="uiok-0-0"><span data-text="true">第三步:执行部署</span></span></p></h3><p><span data-offset-key="7ap7c-0-0"><span data-text="true">点击 Run 按钮之后,即可完成本地应用程序向容器服务 ACK 的部署。</span></span></p><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="1ra86-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="1ra86-0-0"><span data-text="true">如何实现”一键部署“到 host,开发部署提速 8 倍!</span></span></p></h2><p><span data-offset-key="8va6q-0-0"><span data-text="true">这款插件可以将应用部署到 6 种服务器上,分别是:</span></span></p><ul class="public-DraftStyleDefault-ul list-paddingleft-2" data-offset-key="dor6f-0-0" style="padding: 0px; margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><li><p><span data-offset-key="dor6f-0-0"><span data-text="true">Host (任意服务器)</span></span></p></li><li><p><span data-offset-key="cjh56-0-0"><span data-text="true">ECS</span></span></p></li><li><p><span data-offset-key="7pahe-0-0"><span data-text="true">CS K8s</span></span></p></li><li><p><span data-offset-key="8tvm6-0-0"><span data-text="true">EDAS(包括 EDAS for ECS Application &amp; EDAS for K8s Application)</span></span></p></li><li><p><span data-offset-key="ab5ks-0-0"><span data-text="true">Mini Program (小程序云)</span></span></p></li><li><p><span data-offset-key="dktvj-0-0"><span data-text="true">SAE</span></span></p></li></ul><p><span data-offset-key="6jpdl-0-0"><span data-text="true">下面为大家详细解说,如何将应用一键部署到 host。</span></span></p><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="m664-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="m664-0-0"><span data-text="true">第一步:添加服务器</span></span></p></h2><ul class="public-DraftStyleDefault-ul list-paddingleft-2" data-offset-key="8vsl6-0-0" style="padding: 0px; margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><li><p><span data-offset-key="8vsl6-0-0" style="font-weight: bold;"><span data-text="true">点击</span></span><span data-offset-key="8vsl6-0-1"><span data-text="true">:顶部菜单 Tools --&gt; Alibaba Cloud --&gt; Alibaba Cloud View --&gt; Host ,打开机器视图界面,如下图:</span></span></p></li></ul><p><span data-offset-key="b090h-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="90ek8-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0qAOEPwAABQlgBZOKg866.jpg" data-size="normal" data-rawwidth="934" data-rawheight="530" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0qAK9uXAAB6PqSKnmw709.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/FF/pIYBAF3Dz4GAE5miAACKl_eR_U0428.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="7mac4-0-0"><br data-text="true"/></span></p><ul class="public-DraftStyleDefault-ul list-paddingleft-2" data-offset-key="926a6-0-0" style="padding: 0px; margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><li><p><span data-offset-key="926a6-0-0" style="font-weight: bold;"><span data-text="true">点击</span></span><span data-offset-key="926a6-0-1"><span data-text="true">:右上角 Add Host 按钮,出现添加机器界面,如下图,设置相关配置。</span></span></p></li></ul><p><span data-offset-key="7pj0q-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="23ut7-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/FF/pIYBAF3Dz4GAHL4lAABw53gpTNs695.jpg" data-size="normal" data-rawwidth="736" data-rawheight="624" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0uAQL0bAAB2dZ8G7Eg765.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0uAD8bhAAB_-G4VQpo496.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="9961f-0-0"><br data-text="true"/></span></p><h2 class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="j419-0-0" style="margin: 2.33333em 0px 1.16667em; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 1.2em; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; clear: left; color: rgb(26, 26, 26); white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><span data-offset-key="j419-0-0"><span data-text="true">第二步:执行部署</span></span></p></h2><p><span data-offset-key="2cuvu-0-0"><span data-text="true">在 IntelliJ IDEA 中,鼠标右键项目工程名,在出现的菜单中点击 Alibaba Cloud --&gt; Deploy to Host...,会出现如下部署窗口,设置部署参数,然后单击 Deploy,即可执行初次部署。</span></span></p><p><span data-offset-key="3rljf-0-0"><br data-text="true"/></span></p><p><figure class="Editable-styled" data-block="true" data-editor="eat4k" data-offset-key="bvji-0-0" contenteditable="false" style="margin: 1.4em 0px; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><p><img class="Image FocusPlugin--unfocused Image--isBlock" src="http://file.elecfans.com/web1/M00/AC/FF/pIYBAF3Dz4KAVQW2AACNi4N5_K8460.jpg" data-size="normal" data-rawwidth="830" data-rawheight="739" data-watermark="watermark" data-original-src="http://file.elecfans.com/web1/M00/AC/FF/pIYBAF3Dz4OAcpJgAACy0v-kNWo816.jpg" data-watermark-src="http://file.elecfans.com/web1/M00/AC/A7/o4YBAF3Dz0yAXA7qAADF_KdSLbY130.jpg" style="max-width: 100%; margin: 0px auto; display: block;"/></p></figure></p><p><span data-offset-key="6b9a6-0-0"><br data-text="true"/></span></p><p><span data-offset-key="f7jic-0-0"><span data-text="true">部署参数说明:</span></span></p><ul class="public-DraftStyleDefault-ul list-paddingleft-2" data-offset-key="fmoms-0-0" style="padding: 0px; margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(26, 26, 26); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; white-space: pre-wrap; background-color: rgb(255, 255, 255);"><li><p><span data-offset-key="fmoms-0-0" style="font-weight: bold;"><span data-text="true">Deploy File</span></span><span data-offset-key="fmoms-0-1"><span data-text="true">:部署文件包含两种方式;</span></span></p></li><li><p><span data-offset-key="fb61a-0-0" style="font-weight: bold;"><span data-text="true">Maven Build</span></span><span data-offset-key="fb61a-0-1"><span data-text="true">:如果当前工程采用 Maven 构建,可以使用 Cloud Toolkit 直接构建并部署;</span></span></p></li><li><p><span data-offset-key="6npsr-0-0" style="font-weight: bold;"><span data-text="true">Upload File</span></span><span data-offset-key="6npsr-0-1"><span data-text="true">:如果当前工程并非采用 Maven 构建,或者本地已经存在打包好的部署文件,可以选择并直接上传本地的部署文件;</span></span></p></li><li><p><span data-offset-key="elk5r-0-0" style="font-weight: bold;"><span data-text="true">Target Deploy host</span></span><span data-offset-key="elk5r-0-1"><span data-text="true">:在下拉列表中选择 Tag,然后选择要部署的服务器;</span></span></p></li><li><p><span data-offset-key="13kd6-0-0" style="font-weight: bold;"><span data-text="true">Deploy Location</span></span><span data-offset-key="13kd6-0-1"><span data-text="true">:输入在 ECS 上部署路径,如 /root/tomcat/webapps;</span></span></p></li><li><p><span data-offset-key="63h0e-0-0" style="font-weight: bold;"><span data-text="true">Commond</span></span><span data-offset-key="63h0e-0-1"><span data-text="true">:输入应用启动命令,如 sh /root/restart.sh。表示在完成应用包的部署后,需要执行的命令 —— 对于 Java 程序而言,通常是一句 Tomcat 的启动命令。</span></span></p></li></ul><p><span data-offset-key="4opnm-0-0"><span data-text="true">最后,希望今天推荐的插件能够真正帮助大家提高开发部署的效率,提高对工具运用的能力,大家可以安装试用起来,有任何疑问都可以加入社群进行提问。</span></span></p><p><span data-offset-key="e4lqs-0-0"><br data-text="true"/></span></p><p><span data-offset-key="frbfj-0-0"><br data-text="true"/></span></p><p><span data-offset-key="6oist-0-0"><br data-text="true"/></span></p><p><span data-offset-key="8bccl-0-0"><br data-text="true"/></span></p><p><span data-offset-key="6e30i-0-0"><br data-text="true"/></span></p><p><span data-offset-key="7vdhe-0-0"><br data-text="true"/></span></p><p><span data-offset-key="22jkr-0-0"><br data-text="true"/></span></p><p><span data-offset-key="3khsc-0-0"><br data-text="true"/></span></p><p><span data-offset-key="dmnkh-0-0"><br data-text="true"/></span></p><p><a data-offset-key="3ocqb-0-0" data-editable="true" target="_blank" href="https://yq.aliyun.com/articles/723884?utm_content=g_1000085909" class="Link ztext-link" style="text-decoration-line: none; cursor: pointer; border-bottom: 1px solid grey;"><span data-offset-key="3ocqb-0-0"><span data-text="true">原文链接</span></span></a></p><p><span data-offset-key="dg5l-0-0"><span data-text="true">本文为云栖社区原创内容,未经允许不得转载。</span></span></p><p><br/></p>

下载发烧友APP

打造属于您的人脉电子圈

关注电子发烧友微信

有趣有料的资讯及技术干货

关注发烧友课堂

锁定最新课程活动及技术直播

电子发烧友观察

一线报道 · 深度观察 · 最新资讯
收藏 人收藏
分享:

评论

相关推荐