你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

CycleCloud 群集中的自定义映像

默认情况下,Azure CycleCloud 安装使用推荐的群集 OS 映像,但它还支持来自 Azure 市场的映像、Azure 图像库(预览版)、以及用于节点和节点数组的自定义映像。 如果需要在群集中预安装的应用程序或想要满足业务或安全要求,请使用自定义映像。

通过群集 UI 指定自定义映像

群集 UI 支持自定义映像和市场映像。 不选择内置映像,而是选择“自定义映像”并输入映像的完整“资源 ID”或“URN”:

自定义映像

注释

CycleCloud 支持从版本 7.7.0 开始的自定义映像。

在 CycleCloud 模板中使用自定义映像

使用 ImageName 特性指定群集节点使用专用自定义 Azure 映像或市场映像。 对于自定义映像,找到 Azure 门户中的 ID 作为映像的资源 ID。 它通常采用以下形式:

/subscriptions/$SUBSCRIPTION-ID/resourceGroups/$RESOURCEGROUPNAME/providers/Microsoft.Compute/images/$CustomImageName

[[node custom]]

  ImageName = /subscriptions/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/images/MyCustomImage

URN 或资源 ID 定义要使用的市场映像。 获取 URN 或 ID 的最简单方法是通过 Azure CLI

也可使用 URN 指定市场或共享映像:

[[node marketplace]]

 ImageName = publisher:offer:sku:version

注释

低于 7.7.0 的 CycleCloud 版本 需要不同的表示法

将 Azure 市场映像与定价计划配合使用

可以使用带有关联定价计划的“市场平台”镜像,但只有在该镜像被启用用于编程使用时才能使用。 若要启用编程使用,请在市场中找到所需的映像,选择 “希望以编程方式部署”,然后选择“ 入门”->。 填写所需的信息并保存所做的更改。

若要使 CycleCloud 能够代表你自动接受许可条款,请在 Web 界面中 代表订阅启用“接受市场条款 ”选项:

接受市场条款

若要接受 Azure CLI 的许可条款,请使用:

az vm image accept-terms --urn publisher:offer:sku:version

az vm image accept-terms --publisher PUBLISHER --offer OFFER --plan SKU

从 CycleCloud 版本 8.0.2 开始,可以使用从具有定价计划的映像派生的自定义映像。 若要使用此功能,需要一个自定义模板:

[[node custom_image]]

 ImageName = /subscriptions/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/galleries/MyGallery/images/MyImage/versions/1.0.0
 ImagePlan.Publisher = PUBLISHER
 ImagePlan.Product = PRODUCT (sometimes called OFFER)
 ImagePlan.Name = NAME (sometimes called SKU)

如果共享映像库拥有购买计划元数据,CycleCloud 会自动使用它。 无需指定计划详细信息。

创建自定义映像

可以按照 本教程作创建自定义 Azure 映像。

注释

建议使用通用映像。 专用映像不执行删除计算机特定信息和帐户的过程。 它们还缺少 CycleCloud 所需的 osProfile。

CycleCloud 版本早于 7.7.0 的自定义映像

低于 7.7.0 的 CycleCloud 版本支持自定义映像和市场映像,但使用不同的表示法。 若要在低于版本 7.7.0 的 CycleCloud 模板中使用自定义映像,请使用 ImageId 该属性指定自定义 Azure 映像。 可以在 Azure 门户中找到此 ID 作为映像的资源 ID。 它通常采用以下形式:

/subscriptions/$SUBSCRIPTION-ID/resourceGroups/$RESOURCEGROUPNAME/providers/Microsoft.Compute/images/$CustomImageName

对于低于 7.7.0 的 CycleCloud 版本,必须通过提供其发布者、产品/服务、SKU 和版本来显式指定市场映像。 还需要定义 JetpackPlatform 属性,以确保安装了正确的 Jetpack 包。 JetpackPlatform的接受值包括centos-6centos-7ubuntu-14.04ubuntu-16.04windows。 此值应与 Azure 市场映像的操作系统一致。 将 InstallJetpack 设置为 true。

[[node custom]]
  ImageId = /subscriptions/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/images/MyCustomImage
  InstallJetpack = true

[[node marketplace]]
  Azure.Publisher = OpenLogic
  Azure.Offer = CentOS-HPC
  Azure.Sku = 7.4
  Azure.ImageVersion = 7.4.20180301

  # Azure CycleCloud < 7.7.0 jetpack selection attributes
  InstallJetpack = true
  JetpackPlatform = centos-7