在Azure上配置Fedora CoreOS

本指南展示了如何在Azure上配置新的FedoraFCOS(CoreOS)节点。Fedora目前不在Azure中发布FedoraAzure镜像,所以你必须从Fedora下载一个CoreOS镜像并上传到你的Azure订阅中。

先决条件

在配置FCOS计算机之前,您必须具有包含自定义设置的Ignition配置文件。如果您没有,请参见 生成Ignition文件

如果您不想使用Ignition入门,可以使用 加力支撑 并通过云提供商提供SSH密钥,然后从那里继续。

你还需要拥有Azure订阅的访问权限。下面的示例使用 Azure CLI

下载Azure映像

Fedora CoreOS被设计为自动更新,每个流有不同的时间表。 选择相关流后,请下载、验证并解压缩最新的Azure映像:

stream="stable"
coreos-installer download --decompress -s "${stream}" -p azure -f vhd.xz

或者,您也可以从 下载页面 。按照该页面上的说明验证下载,然后将其解压缩。

正在将图像上载到Azure

创建你的Azure帐户中尚不存在的任何资源:

+ .创建Azure资源的示例

az_region="westus2"
az_resource_group="my-group"
az_storage_account="mystorageacct"
az_container="my-container"
# Create resource group
az group create -l "${az_region}" -n "${az_resource_group}"
# Create storage account for uploading FCOS image
az storage account create -g "${az_resource_group}" -n "${az_storage_account}"
# Retrieve connection string for storage account
cs=$(az storage account show-connection-string -n "${az_storage_account}" | jq -r .connectionString)
# Create storage container for uploading FCOS image
az storage container create --connection-string "${cs}" -n "${az_container}"
创建FCOS映像:

+ .创建Azure映像的示例

downloaded_image_file="./image.vhd"
az_image_name="my-fcos-image"
az_image_blob="${az_image_name}.vhd"
# Upload image blob
az storage blob upload --connection-string "${cs}" -c "${az_container}" -f "${downloaded_image_file}" -n "${az_image_blob}"
# Create the image
az image create -n "${az_image_name}" -g "${az_resource_group}" --source "https://${az_storage_account}.blob.core.windows.net/${az_container}/${az_image_blob}" --location "${az_region}" --os-type Linux
# Delete the uploaded blob
az storage blob delete --connection-string "$cs" -c "${az_container}" -n "${az_image_blob}"

启动一个VM实例

启动一个VM。您的Ignition配置可以作为自定义数据传递到VM,或者,如果您只想要SSH访问,也可以跳过传递自定义数据。您的SSH公钥来自 ~/.ssh 将自动添加到该VM中。这提供了一种简单的方法来测试FCOS,而无需首先创建Ignition配置。

+ .启动Azure映像的示例

az_vm_name="my-fcos-vm"
ignition_path="./config.ign"
az vm create -n "${az_vm_name}" -g "${az_resource_group}" --image "${az_image_name}" --admin-username core --custom-data "$(cat ${ignition_path})"