背景信息

<p>使用Packer创建自定义镜像时,需要创建一个JSON格式的模板文件。在该模板文件中,您需要指定创建自定义镜像的 PACloud Image Builder(生成器) 和 Provisioners(配置器)。Packer具有多种配置器,可用于配置自定义镜像的内容生成方式。在构建时,平安云构建器将会自动地创建所需要的资源,但有时会存在资源数量过多无法创建新资源或资源创建和清理的速度较慢等问题而倾向于复用老的资源,这时请参照下图将旧资源的描述改为&quot;packer&quot;,在随后的构建中构建器将会复用该资源而不会进行清理。</p> <p><img src="https://pcp-portal-sca.obs-cn-shenzhen.pinganyun.com/pcp-portal-sca/20191007102002-1407b97797fd.png" style="height:123px; width:393px" /></p> <p>您需要自定义以下参数值。</p> <table border="1" cellpadding="0" cellspacing="0" style="width:811px"> <tbody> <tr> <td style="background-color:#ededed; vertical-align:top; width:195px"> <p><strong>参数</strong></p> </td> <td style="background-color:#ededed; vertical-align:top; width:134px"> <p><strong>类型</strong></p> </td> <td style="background-color:#ededed; vertical-align:top; width:474px"> <p><strong>描述</strong></p> </td> </tr> <tr> <td style="vertical-align:top"> <p>url</p> </td> <td style="vertical-align:top"> <p>string</p> </td> <td style="vertical-align:top"> <p>API地址。</p> <p><strong>说明:</strong>程序在检测到该值为空时会自动填入一个默认值,因此通常不需要配置。但如果您需要在平安金融云之类其他非yun.pingan.com域名的、归属于平安的专有云下使用packer,则需要填入该专有云的API网关地址。</p> <p>目前支持的地址如下:</p> <p>平安金融云:https:// fincloud.pinganyun.com/api/v1</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>access_key_id</p> </td> <td style="vertical-align:top; width:134px"> <p>string</p> </td> <td style="vertical-align:top; width:474px"> <p>您的Access Key ID。</p> <p>说明:如何查询您的Access Key ID,请参考附录说明中的获取Access Key ID和Access Key Secret。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>access_key_secret</p> </td> <td style="vertical-align:top; width:134px"> <p>string</p> </td> <td style="vertical-align:top; width:474px"> <p>您的Access Key Secret。</p> <p><strong>说明:</strong>如何查询您的Access Key Secret,请参考附录说明中的<strong>获取Access Key ID和Access Key Secret</strong>。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>zone_name</p> </td> <td style="vertical-align:top; width:134px"> <p>string</p> </td> <td style="vertical-align:top; width:474px"> <p>创建自定义镜像时使用的地域编号。</p> <p><strong>说明:</strong>如何查询地域编号,请参考本文档附录说明中的查询地域编号。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>image_name</p> </td> <td style="vertical-align:top; width:134px"> <p>string</p> </td> <td style="vertical-align:top; width:474px"> <p>自定义镜像的名称。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>source_image_id</p> </td> <td style="vertical-align:top; width:134px"> <p>string</p> </td> <td style="vertical-align:top; width:474px"> <p>平安云基础镜像的ID。</p> <p><strong>说明:</strong>如何获取平安云镜像对应的ID,请参考附录说明中的获取平安云基础镜像ID。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>provisioners&nbsp;</p> </td> <td style="vertical-align:top; width:134px"> <p>[]provisioner</p> </td> <td style="vertical-align:top; width:474px"> <p>创建自定义镜像时使用的 Packer 配置器类型。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>cpu_amount</p> </td> <td style="vertical-align:top; width:134px"> <p>int</p> </td> <td style="vertical-align:top; width:474px"> <p>自定义镜像的CPU核心数。</p> <p><strong>说明:</strong>如果未定义cpu_amount和memory_size_mb,则会选择最便宜的计算方案生成自定义镜像。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>memory_size_mb</p> </td> <td style="vertical-align:top; width:134px"> <p>int</p> </td> <td style="vertical-align:top; width:474px"> <p>自定义镜像的内存大小(MB)。</p> <p><strong>说明:</strong>如果未定义cpu_amount和memory_size_mb,则会选择最便宜的计算方案生成自定义镜像。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>timeout</p> </td> <td style="vertical-align:top; width:134px"> <p>int</p> </td> <td style="vertical-align:top; width:474px"> <p>单次连接平安云时的超时时间。</p> <p><strong>说明:</strong>如果未定义则会被设置为10秒。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>cleanup_nat</p> </td> <td style="vertical-align:top; width:134px"> <p>bool</p> </td> <td style="vertical-align:top; width:474px"> <p>在清理资源时是否删除在构建镜像时创建的NAT。</p> <p><strong>说明:</strong>在华东以外的可用区构建镜像时,为了连接到虚拟机上进行操作会自动创建一个NAT,但NAT的创建时间和删除时间都比较长,如果您在短时间内需要构建多个镜像,那么可以选择将此选项置为真,此时在清理资源时就不会讲创建的NAT清理掉。</p> </td> </tr> <tr> <td style="vertical-align:top; width:195px"> <p>init_wait_timeout_minute</p> </td> <td style="vertical-align:top; width:134px"> <p>int</p> </td> <td style="vertical-align:top; width:474px"> <p>在构建镜像时等待虚拟机初始化完成的超时时间。</p> <p><strong>说明:</strong>在华东区构建镜像时,为了连接到虚拟机上进行操作会自动为虚拟机挂载一个EIP,由于该操作必须要虚拟机内的agent配合才能完成,因此必须要等待初始化完成后才能进行挂载,如果未定义则会被设置为10分钟。</p> </td> </tr> </tbody> </table>
以上内容是否解决了您的问题?
请补全提交信息!
咨询·建议

电话咨询

400-151-8800

邮件咨询

cloud@pingan.com

在线客服

工单支持

解决云产品相关技术问题