创建Service
<p class="shortdesc">对于只在内网工作的应用,您可创建服务来进行通信。本文主要介绍如何创建Service。</p>
<section class="section prereq" id="create9__prereq_hjj_shj_2sb"><div class="tasklabel"><h2 class="doc-tairway">前提条件</h2></div>
<ul class="ul" id="create9__ul_vjk_pqm_fvb">
<li class="li">您已成功创建管理集群,可参考<a class="xref" href="/ssr/help/compute/caas/Operation_Guide.Cluster_Management.Master_Cluster.create" target="_blank" rel="external noopener">创建管理集群</a>。</li>
<li class="li">您已成功创建业务集群,可参考<a class="xref" href="/ssr/help/compute/caas/Operation_Guide.Cluster_Management.worker.create" target="_blank" rel="external noopener">创建业务集群</a>。</li>
<li class="li">您已成功创建无状态应用,可参考<a class="xref" href="/ssr/help/compute/caas/Operation_Guide.Service_Management.Deployment.create" target="_blank" rel="external noopener">创建无状态应用</a>。</li>
</ul>
</section>
<section id="create9__steps_h4m_tqm_fvb"><div class="tasklabel"><h2 class="doc-tairway">操作步骤</h2></div><ol class="ol steps" id="create9__steps_h4m_tqm_fvb"><li class="li step stepexpand">
<span class="ph cmd">登录<a class="xref" href="https://www.ocftcloud.com/console/caas/overview" target="_blank" rel="external noopener">容器服务CaaS控制台</a>。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">单击左侧导航栏<span class="ph menucascade"><span class="ph uicontrol">网络管理</span><abbr> > </abbr><span class="ph uicontrol">Service</span></span>。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">选择目标地域,单击页面右上角的<span class="ph uicontrol">创建</span>。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">根据如下信息,创建Service。</span>
<div class="itemgroup info">
<table class="table" id="create9__table_sxl_hv4_jsb"><caption></caption><colgroup><col style="width:39.525691699604735%"><col style="width:60.47430830039525%"></colgroup><thead class="thead">
<tr class="row">
<th class="entry colsep-1 rowsep-1" id="create9__table_sxl_hv4_jsb__entry__1">
<p class="p"> 配置项 </p>
</th>
<th class="entry colsep-1 rowsep-1" id="create9__table_sxl_hv4_jsb__entry__2">
<p class="p"> 说明 </p>
</th>
</tr>
</thead><tbody class="tbody">
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">地域 </p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p">选择创建Service的地域。</p>
</td>
</tr>
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">可用区</p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p">选择创建Service的可用区。</p>
</td>
</tr>
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">管理集群</p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p">选择创建Service的管理集群。</p>
</td>
</tr>
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">业务集群</p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p">选择创建Service的业务集群。</p>
</td>
</tr>
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">服务名称</p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p">设置Service的名称。请输入6-63个字符,可以包含小写英文字母、数字和中划线(-),并以小写字母开头,小写字母或者数字结尾。</p>
</td>
</tr>
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">访问类型 </p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p">选择访问类型,目前支持:</p>
<ul class="ul" id="create9__ul_omz_hzm_fvb">
<li class="li">集群内访问(ClusterIP):通过服务IP + 服务端口访问。</li>
<li class="li">节点访问(NodePort):通过节点IP + 主机端口访问。</li>
<li class="li">负载均衡(LoadBalancer):通过ELB实例 + 主机端口访问。</li>
</ul>
</td>
</tr>
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">关联应用 </p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p">选择服务需要关联的应用。 </p>
</td>
</tr>
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">服务名称 </p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p"> 输入服务名称。 </p>
</td>
</tr>
<tr class="row">
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__1 ">
<p class="p">端口映射 </p>
</td>
<td class="entry colsep-1 rowsep-1" headers="create9__table_sxl_hv4_jsb__entry__2 ">
<p class="p">协议:TCP、UDP、HTTP(仅负载均衡访问下使用)、HTTPS(仅负载均衡访问下使用)。</p>
<ul class="ul" id="create9__ul_xx5_5f2_vvb">
<li class="li">容器端口:为容器内应用程序监听的端口</li>
<li class="li">服务端口:建议与容器端口一致</li>
</ul>
</td>
</tr>
</tbody></table>
</div>
</li><li class="li step stepexpand">
<span class="ph cmd">单击<span class="ph uicontrol">创建</span>。</span>
</li></ol></section>
<section class="section result" id="create9__result_oy2_bcn_fvb"><div class="tasklabel"><h2 class="doc-tairway">执行结果</h2></div>
<p class="p">在<span class="keyword wintitle">Service</span>页面,可以查看到已成功创建的Service。</p>
</section>
提交成功!非常感谢您的反馈,我们会继续努力做到更好!