Provisionando Fedora CoreOS no DigitalOcean

Este guia mostra como provisionar novos nós do Fedora CoreOS (FCOS) no DigitalOcean. As imagens do Fedora CoreOS atualmente não são publicadas diretamente no DigitalOcean, então você deve baixar uma imagem de Fedora CoreOS do DigitalOcean e enviá-la para sua conta DigitalOcean como imagem personalizada.

Pré-Requisitos

Antes de provisionar uma máquina FCOS, você deve ter um arquivo de configuração do Ignition contendo suas personalizações. Se você não tiver um, consulte Produzindo um arquivo de Ignition.

Fedora CoreOS has a default core user that can be used to explore the OS. If you want to use it, finalize its configuration by providing e.g. an SSH key.

If you do not want to use Ignition to get started, you can make use of the Afterburn support.

You also need to have access to a DigitalOcean account. The examples below use the doctl command-line tool and jq as a command-line JSON processor.

Criando uma imagem personalizada do DigitalOcean

O Fedora CoreOS é projetado para ser atualizado automaticamente, com horários diferentes por fluxo.

  1. Once you have picked the relevant stream, find the corresponding DigitalOcean image on the download page and copy the URL of the Download link.

  2. Crie a imagem personalizada:

    Exemplo de upload de FCOS para uma imagem personalizada DigitalOcean
    doctl compute image create my-fcos-image --region sfo2 --image-url <download-url>
    # Wait for image creation to finish
    while ! doctl compute image list-user --output json | jq -c '.[] | select(.name=="my-fcos-image")' | grep available; do sleep 5; done

The above command uploads the image and waits until it is ready to be used. This process can take a long time, in our testing we have seen it take up to 15 minutes. Wait time is dependent on upload speeds and platform load.

Iniciando um droplet

  1. Se você ainda não fez upload de uma chave SSH para DigitalOcean, faça upload de uma:

    Exemplo de upload de uma chave SSH para DigitalOcean
    doctl compute ssh-key create my-key --public-key "$(cat ~/.ssh/id_rsa.pub)"
  2. Launch a droplet. Your Ignition configuration can be passed to the VM as its user data, or you can skip passing user data if you just want SSH access. This provides an easy way to test out FCOS without first creating an Ignition config.

    Ao criar um droplet para FCOS da DigitalOcean, você deve especificar uma chave SSH para o droplet, mesmo se você planeje injetar chaves SSH por meio do Ignition.

    Exemplo de inicialização do FCOS no DigitalOcean usando um arquivo de configuração do Ignition
    image_id=$(doctl compute image list-user | grep my-fcos-image | cut -f1 -d ' ')
    key_id=$(doctl compute ssh-key list | grep my-key | cut -f1 -d ' ')
    doctl compute droplet create my-fcos-droplet --image "${image_id}" --region sfo2 --size s-2vcpu-2gb --user-data-file <arquivo-config-ignition> --ssh-keys "${key_id}" --wait
    While the DigitalOcean documentation mentions cloud-init and scripts, FCOS does not support cloud-init or the ability to run scripts from user-data. It accepts only Ignition configuration files.
  3. You now should be able to SSH into the instance using the associated IP address.

    Example connecting
    ssh core@<ip address>