5.9.11. 为 Azure 基础架构创建 RHCOS 集群镜像

您必须对 OpenShift Container Platform 节点的 Microsoft Azure 使用有效的 Red Hat Enterprise Linux CoreOS(RHCOS)镜像。

先决条件

  • 配置 Azure 帐户。
  • 为集群生成 Ignition 配置文件。
  • 将 RHCOS 虚拟硬盘(VHD)集群镜像存储在 Azure 存储容器中。
  • 在 Azure 存储容器中存储 bootstrap Ignition 配置文件。

流程

  1. 复制镜像存储的 ARM 模板 部分中的模板,并将它以 02_storage.json 保存到集群的安装目录中。此模板描述了集群所需的镜像存储。
  2. 以一个变量的形式将 RHCOS VHD blob URL 导出:

    $ export VHD_BLOB_URL=`az storage blob url --account-name ${CLUSTER_NAME}sa --account-key ${ACCOUNT_KEY} -c vhd -n "rhcos.vhd" -o tsv`
  3. 部署集群镜像

    $ az deployment group create -g ${RESOURCE_GROUP} \
      --template-file "<installation_directory>/02_storage.json" \
      --parameters vhdBlobURL="${VHD_BLOB_URL}" \ 1
      --parameters baseName="${INFRA_ID}"2
    1
    用于创建 master 和 worker 机器的 RHCOS VHD 的 blob URL。
    2
    资源名称使用的基本名称 ; 这通常是集群的基础架构 ID。

5.9.11.1. 镜像存储的 ARM 模板

您可以使用以下 Azure Resource Manager(ARM)模板来部署 OpenShift Container Platform 集群所需的存储的 Red Hat Enterprise Linux CoreOS(RHCOS)镜像:

例 5.2. 02_storage.json ARM 模板

{
  "$schema" : "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion" : "1.0.0.0",
  "parameters" : {
    "baseName" : {
      "type" : "string",
      "minLength" : 1,
      "metadata" : {
        "description" : "Base name to be used in resource names (usually the cluster's Infra ID)"
      }
    },
    "vhdBlobURL" : {
      "type" : "string",
      "metadata" : {
        "description" : "URL pointing to the blob where the VHD to be used to create master and worker machines is located"
      }
    }
  },
  "variables" : {
    "location" : "[resourceGroup().location]",
    "imageName" : "[concat(parameters('baseName'), '-image')]"
  },
  "resources" : [
    {
      "apiVersion" : "2018-06-01",
      "type": "Microsoft.Compute/images",
      "name": "[variables('imageName')]",
      "location" : "[variables('location')]",
      "properties": {
        "storageProfile": {
          "osDisk": {
            "osType": "Linux",
            "osState": "Generalized",
            "blobUri": "[parameters('vhdBlobURL')]",
            "storageAccountType": "Standard_LRS"
          }
        }
      }
    }
  ]
}