Aprovisionando Fedora CoreOS sobre Alibaba Cloud (Aliyun)
This guide shows how to provision new Fedora CoreOS (FCOS) nodes on Alibaba Cloud. Fedora currently does not publish Fedora CoreOS images within Alibaba Cloud, so you must download an Alibaba Cloud image from Fedora and upload it to one of your Object Storage Service (OSS) buckets.
Requisitos previos
Antes de aprovisionar una máquina FCOS, usted debe tener un archivo de configuración Ignition que contenga sus personalizaciones. Si no tiene uno vea Produciendo un Archivo Ignition.
Fedora CoreOS tiene un usuario core predeterminado que puede ser usado para explorar el SO. Si usted desea utilizarlo finalice su configuración proporcionando una clave SSH.
|
Si no desea usar Ignition para empezar, puede usar Soporte Afterburn.
También necesita tener acceso a una cuenta Alibaba Cloud y activar el Servicio de Almacenamiento de Objeto (OSS). Los ejemplos siguientes usan Alibaba Cloud CLI y jq como línea de comandos del procesador JSON.
Descargando una imagen Alibaba Cloud
Fedora CoreOS está diseñado para ser actualizado automáticamente con diferentes horarios por transmisión. Una vez que haya elegido la transmisión relevante, descargue, verifique y descomprima la última imagen Alibaba Cloud:
STREAM="stable"
coreos-installer download --decompress -s "${STREAM}" -p aliyun -f qcow2.xz
Alternatively, you can manually download an Alibaba Cloud image from the download page. Verify the download, following the instructions on that page, and decompress it.
Uploading the image to Alibaba Cloud
-
Create any bucket that doesn’t already exist in your Alibaba Cloud account with a globally unique name or reuse an existing bucket:
Example creating Alibaba Cloud OSS (Object Storage Service) bucketREGION="ap-southeast-1" BUCKET_NAME="my-bucket" BUCKET_URL="oss://${BUCKET_NAME}" aliyun oss mb "${BUCKET_URL}" --region="${REGION}" --acl=private
-
Upload an FCOS image:
Example uploading FCOS to an Alibaba Cloud OSS bucketDOWNLOADED_IMAGE="./image.qcow2" IMAGE_NAME="my-fcos-image" IMAGE_BLOB="${IMAGE_NAME}.qcow2" aliyun oss cp "${DOWNLOADED_IMAGE}" "${BUCKET_URL}/${IMAGE_BLOB}" \ --region="${REGION}" --acl=private
-
Import uploaded FCOS image:
Example importing FCOS to Alibaba Cloud ECSTASK_ID=$(aliyun ecs ImportImage \ --region="${REGION}" \ --DiskDeviceMapping.1.OSSBucket="${BUCKET_NAME}" \ --DiskDeviceMapping.1.OSSObject="${IMAGE_BLOB}" \ --ImageName="${IMAGE_NAME}" \ | jq --raw-output .TaskId)
-
Wait until the image was successfully imported
Example waiting with a timeout equal to one houraliyun ecs DescribeTasks --region="${REGION}" --TaskIds="${TASK_ID}" \ --waiter expr='TaskSet.Task[0].TaskStatus' to=Finished timeout=3600
-
Determine id of imported FCOS image:
Example determining id of the imported FCOS imageIMAGE_ID=$(aliyun ecs DescribeImages --region="${REGION}" --ImageName="${IMAGE_NAME}" \ | jq --raw-output .Images.Image[0].ImageId)
-
Delete uploaded blob
Example deleting uploaded blobaliyun oss rm "${BUCKET_URL}/${IMAGE_BLOB}" --region "${REGION}"
Creating a VSwitch
There exists no default VPCs or VSwitches in Alibaba Cloud. Hence, for creating any instances a VSwitch must exist. Pick some existing or create one with the following steps.
-
Create a new VPC:
Example creating a new VPCVPC_CIDR="172.16.0.0/12" VPC_NAME="fcos-test" VPC_ID=$(aliyun vpc CreateVpc --region="${REGION}" \ --CidrBlock="${VPC_CIDR}" --VpcName="${VPC_NAME}" \ | jq --raw-output .VpcId)
-
Pick some availability zone for creating a VSwitch:
Example pick some availability zoneZONE_ID=$(aliyun ecs DescribeZones --region="${REGION}" \ | jq --raw-output .Zones.Zone[0].ZoneId)
-
Create a new VSwitch:
Example creating a new VSwitchVSWITCH_CIDR="172.16.0.0/16" VSWITCH_NAME="${VPC_NAME}" VSWITCH_ID=$(aliyun vpc CreateVSwitch \ --region="${REGION}" \ --CidrBlock="${VSWITCH_CIDR}" \ --VpcId="${VPC_ID}" \ --VSwitchName="${VSWITCH_NAME}" \ --ZoneId="${ZONE_ID}" \ | jq --raw-output .VSwitchId)
Launching an ECS instance
-
Upload an SSH public key to Alibaba Cloud ECS
Example uploading an SSH public keyKEY_PAIR_NAME="fcos-key" PUBLIC_KEY_PATH="<Please fill the path to your public key>" PUBLIC_KEY_BODY=$(cat ${PUBLIC_KEY_PATH}) aliyun ecs ImportKeyPair --region="${REGION}" \ --KeyPairName="${KEY_PAIR_NAME}" --PublicKeyBody="${PUBLIC_KEY_BODY}"
-
Creating an ECS instance
Example creating ECS instanceINSTANCE_NAME="my-fcos-vm" INSTANCE_TYPE="ecs.t6-c1m1.large" INSTANCE_ID=$(aliyun ecs CreateInstance \ --region="${REGION}" \ --KeyPairName="${KEY_PAIR_NAME}" \ --ImageId="${IMAGE_ID}" \ --InstanceName="${INSTANCE_NAME}" \ --InstanceType="${INSTANCE_TYPE}" \ --InternetChargeType=PayByTraffic \ --InternetMaxBandwidthIn=5 \ --InternetMaxBandwidthOut=5 \ --VSwitchId="${VSWITCH_ID}" \ | jq --raw-output .InstanceId)
-
Allocate a public IPv4 address for the previously created instance
Example allocating a public IP addressPUBLIC_IP=$(aliyun ecs AllocatePublicIpAddress \ --region="${REGION}" --InstanceId="${INSTANCE_ID}" \ | jq --raw-output .IpAddress)
-
Start the instance
Example starting an instancealiyun ecs StartInstance --region="${REGION}" --InstanceId="${INSTANCE_ID}"
-
Wait until the instance is running
Example waiting and determining the public IP addressaliyun ecs DescribeInstanceStatus --InstanceId.1="$INSTANCE_ID" --region="${REGION}" \ --waiter expr='InstanceStatuses.InstanceStatus[0].Status' to=Running timeout=600
-
Connect to the new instance via SSH
Ejemplo de conexiónssh core@"${PUBLIC_IP}"
You can start a customized instance with your Ignition file by adding the parameter --UserData=$(cat <Path to your Ignition config> | base64 -w0)
to the aliyun ecs CreateInstance
command that creates a new instance.
Want to help? Learn how to contribute to Fedora Docs ›