Introduzione a Fedora CoreOS

Introduzione

Stream

Ci sono tre flussi di aggiornamento disponibili per Fedora CoreOS (FCOS): stable, testing e next. In generale, si consiglia di utilizzare stable, ma è raccomandato eseguire alcune macchine su testing e next e fornire feedback.

Ogni stream ha un URL canonico che rappresenta il suo stato attuale in formato JSON, noto come "stream metadata". Ad esempio, l’URL del metadata per lo stream stable è: https://builds.coreos.fedoraproject.org/streams/stable.json

For automating Fedora CoreOS installations, it is expected that you will interact with stream metadata. While Fedora CoreOS does automatic in-place updates, it is generally recommended to start provisioning new machines from the latest images.

For more information on using stream metadata, see Stream Metadata. For more about the available streams, see Update Streams.

Provisioning Philosophy

Fedora CoreOS non ha un disco di installazione separato. Invece, ogni istanza inizia da un’immagine disco generica che viene personalizzata al primo avvio tramite [Ignition](https://github.com/coreos/ignition).

Each platform has specific logic to retrieve and apply the first boot configuration. For cloud deployments, Ignition gathers the configuration via user-data mechanisms. In the case of bare metal, Ignition can fetch its configuration from the disk or from a remote source.

For more information on configuration, refer to the documentation for Producing an Ignition File.

Quickstart

Booting on a cloud VM (AWS example)

Nuove istanze AWS possono essere create direttamente dalle immagini pubbliche di FCOS. Puoi trovare l’AMI più recente per ciascuna regione dalla [pagina di download](https://fedoraproject.org/coreos/download/).

Se sei interessato solo a esplorare FCOS senza ulteriori personalizzazioni, puoi utilizzare una [coppia di chiavi SSH registrata](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) per l’utente predefinito core.

Per testare FCOS in questo modo, dovrai eseguire il comando aws ec2 run-instances e fornire alcune informazioni per avviare l’istanza. Ecco un esempio di comando che puoi utilizzare:

Avvio di una nuova istanza
# Nome dell'istanza
NAME='instance1'

# Nome della tua chiave SSH (verifica con: `aws ec2 describe-key-pairs`)
SSHKEY='my-key'

# ID dell'AMI (può essere trovato nella pagina di download di Fedora CoreOS o altra immagine)
IMAGE='ami-xxx'

# Dimensione del disco in GB
DISK='20'

# Regione AWS di destinazione
REGION='us-east-1'

# Tipo di istanza (es. t3.micro, m5.large, ecc.)
TYPE='m5.large'

# ID della subnet (verifica con: `aws ec2 describe-subnets`)
SUBNET='subnet-xxx'

# Gruppi di sicurezza (verifica con: `aws ec2 describe-security
Puoi scoprire l’indirizzo IP assegnato all’istanza eseguendo aws ec2 describe-instances

You now should be able to SSH into the instance using the associated IP address.

Example connecting
ssh core@<ip address>

A more complete example that allows customization is described in Fornitura di Fedora CoreOS su Amazon Web Services.

Booting on a local hypervisor (libvirt example)

  1. Recupera l’immagine più recente adatta alla piattaforma qemu usando coreos-installer (oppure scaricala e verifica dal web all’indirizzo https://fedoraproject.org/coreos/download/). Puoi usare coreos-installer come container da https://quay.io/repository/coreos/coreos-installer, oppure su Fedora installalo dai repository.

    STREAM="stable"
    # come binario installato:
    coreos-installer download -s $STREAM -p qemu -f qcow2.xz --decompress -C ~/.local/share/libvirt/images/
    # o come container:
    podman run --pull=always --rm -v "${HOME}/.local/share/libvirt/images/:/data" -w /data \
        quay.io/coreos/coreos-installer:release download -s $STREAM -p qemu -f qcow2.xz --decompress
  2. Avvia una nuova macchina tramite virt-install, utilizzando il file Ignition con le tue personalizzazioni.

    # Percorso al file di configurazione Ignition
    IGNITION_CONFIG="/percorso/a/example.ign"
    
    # Percorso all'immagine disco QCOW2
    IMAGE="/percorso/a/image.qcow2"
    
    # Nome della macchina virtuale
    VM_NAME="fcos-test-01"
    
    # Numero di CPU virtuali assegnate
    VCPUS="2"
    
    # Quantità di RAM (in megabyte)
    RAM_MB="2048"
    
    # Canale di aggiornamento di Fedora CoreOS (es. stable, testing, next)
    STREAM="stable"
    
    # Dimensione del disco (in gigabyte)
    DISK_GB="10"
    
    # Per architetture x86 / aarch64
    IGNITION_DEVICE_ARG=(--qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${IGNITION_CONFIG}")
    
    # Per s390x / ppc64le,
    IGNITION_DEVICE_ARG=(--disk path="${IGNITION_CONFIG}",format=raw,readonly=on,serial=ignition,startup_policy=optional)
    
    # Setup the correct SELinux label to allow access to the config
    chcon --verbose --type svirt_home_t ${IGNITION_CONFIG}
    
    virt-install --connect="qemu:///system" --name="${VM_NAME}" --vcpus="${VCPUS}" --memory="${RAM_MB}" \
            --os-variant="fedora-coreos-$STREAM" --import --graphics=none \
            --disk="size=${DISK_GB},backing_store=${IMAGE}" \
            --network bridge=virbr0 "${IGNITION_DEVICE_ARG[@]}"
virt-install requires both the OS image and Ignition file to be specified as absolute paths.
Depending on your version of virt-install, you may not be able to use --os-variant=fedora-coreos-* and will get an error. In this case, you should pick an older Fedora variant (--os-variant=fedora31 for example). You can find the variants that are supported by you current version of virt-install with osinfo-query os | grep '^\s*fedora'.
DISK_GB should be at least as big as the default size of the image. For Fedora CoreOS, this is currently 10 GB.
Make sure that your user has access to /dev/kvm. The default is to allow access for everyone, but on some distributions you may need to add yourself to the kvm group.
Puoi uscire dalla console seriale premendo CTRL + ].

If you set up an SSH key for the default core user, you can SSH into the VM and explore the OS:

ssh core@<ip address>

Exploring the OS

Once the VM has finished booting, its IP addresses will appear on the console. By design, there are no hard-coded default credentials.

If you set up an SSH key for the default core user, you can SSH into the VM and explore the OS:

ssh core@<ip address>

Getting in touch

We recommend that all users subscribe to the low-volume coreos-status mailing list for operational notices related to Fedora CoreOS.

Bugs can be reported to the Fedora CoreOS Tracker.

For live questions, feel free to reach out in the #coreos:fedoraproject.org room on Matrix.

For doubts and longer discussions related to Fedora CoreOS, a forum and a mailing list are available.