The introduction of container Linux is a paradigm shift. Container-optimized distros make the best foundation for cloud-native infrastructure. In our previous guides, we have gone through how to how to Run Fedora CoreOS (FCOS) on V.Mware Workstation and how to Deploy Multi-Node OKD 4 Cluster using Fedora CoreOS. FCOS is a minimal monolithic OS that can be used to securely spin containerized workloads. This project has been of great help for many years but its deprecation has led to the glorious rise of Flatcar Linux.
Flatcar Linux is a Linux operating system that can be used to perform optimizations for containerized workloads with thinner sizes than typical Linux systems. It ships a minimal OS image with all the necessary tools to run a container. Shipping the OS is done through an immutable filesystem and also includes automatic system updates.
The main features provided by Flatcar Container Linux are:
- Automated atomic updates guarantee you the latest security updates and open-source technologies.
- Minimal OS image that only consists of the tools needed to run containers. No package manager, and no configuration drift.
- OS is delivered on an immutable filesystem, eliminating a whole category of security vulnerabilities.
Flatcar Container Linux can be run on several platforms such as Azure, AWS, Vagrant, Vmware, Google Cloud, Digital Ocean etc. During the installation and provisioning, you need to know these two concepts:
- Butane Config: This is a human-readable YAML file that needs to be converted to into Ignition V3 config before being used.
- Ignition config: This is a machine-readable JSON that is used to configure the Flatcar. This config can be passed using the “custom data” or “user data” option of cloud providers. You can also pass it via several other mechanisms on private cloud VMs and bare metal. This config can be used to perform the following:
- add custom users and groups
- create and manage storage devices, file systems, and swap, and create custom files
- customise automatic updates and define reboot windows
- create custom network(d) configurations and systemd units
If you’re using Proxmox check out:
By following this guide to the end, you should be able to install Flatcar Container Linux in VMware Workstation.
Install Flatcar Container Linux in VMware Workstation
In this guide, you need VMware Workstation installed on your system. Our page provides a number of dedicated guides to help you achieve this:
- On Debian
- On Arch Linux/Manjaro
- On CentOS/Rocky Linux/Alma Linux
- On Kali Linux
1. Download Flatcar Container Linux OVA
The Flatcar Container Linux OVA file can be downloaded from the Flatcar release page. To make it easier, you can pull the OVA files using cURL.
##For Stable Channel
curl -LO https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_vmware_ova.ova
##For Beta Channel
curl -LO https://beta.release.flatcar-linux.net/amd64-usr/current/flatcar_production_vmware_ova.ova
##For Alpha Channel
curl -LO https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_vmware_ova.ova
2. Create an Ignition Config for Flatcar Container Linux
We will now create the JSON format file bearing all the required configurations for our installation. We will start by creating a Butane config.
vim flatcar.bu
For this guide, we will make simple provisioning that includes setting up SSH keys for the VM. There are several other configurations that you can exploit on your own.
variant: flatcar
version: 1.0.0
passwd:
users:
- name: core
ssh_authorized_keys:
- replace-me-with-public-ssh-key
In the file above, remember to replace the replace-me-with-public-ssh-key above with an actual SSH public key of your host system. To view your SSH keys use the command:
cat ~/.ssh/id_rsa.pub
Once the required changes have been made, convert the YAML into an ignition file using butane. The easiest way is to use Podman:
- Install Podman on Debian
- Install Podman on Fedora / CentOS / RHEL 7|8
- Install Podman on Ubuntu
- Install Podman on Arch Linux / Manjaro
Once installed, run Butane:
podman run --interactive --rm quay.io/coreos/butane:release \
--pretty --strict < flatcar.bu > flatcar.ign
Now we will have a generated Ignition file (JSON) with the name flatcar.ign
$ cat flatcar.ign
{
"ignition": {
"version": "3.3.0"
},
"passwd": {
"users": [
{
"name": "core",
"sshAuthorizedKeys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAAD*********47Xy7s= [email protected]"
]
}
]
}
}
Now we will convert the Ignition file to a base64, or gzip+base64. This can be done with the commands:
- For base64
CONFIG_ENCODING='base64'
CONFIG_ENCODED=$(cat flatcar.ign | base64 -w0 -)
- For gzip+base64
CONFIG_ENCODING='gzip+base64' CONFIG_ENCODED=$(cat flatcar.ign | gzip -9 | base64 -w0 -)
3. Run Flatcar Container Linux on VMware Workstation
Having met all the requirements. We will boot into the Flatcar Container Linux. From the command line, you can spin up the VM with the commands:
First export variables:
VM_NAME='flatcar-VM'
FLATCAR_OVA='flatcar_production_vmware_ova.ova'
LIBRARY="$HOME/Virtual Machines.localized"
Spin the VM:
ovftool \
--powerOffTarget \
--name="${VM_NAME}" \
--allowExtraConfig \
--extraConfig:guestinfo.ignition.config.data.encoding="${CONFIG_ENCODING}" \
--extraConfig:guestinfo.ignition.config.data="${CONFIG_ENCODED}" \
--net:"VM Network"="Bridge" \
"${FLATCAR_OVA}" "${LIBRARY}"
Remember to provide the exact path to your FLATCAR_OVA. You can also replace the variables as desired such as the Network, to use NAT replace the value as shown:
--net:"VM Network"="NAT"
You now have the new VMware workstation files generated as shown:
Opening OVA source: flatcar_production_vmware_ova.ova
The manifest validates
Opening VMX target: /home/debian/Virtual Machines.localized
Writing VMX file: /home/debian/Virtual Machines.localized
Transfer Completed
Completed successfully
Now you will have a VM with the name flatcar-VM. If the VM does not appear, you can manually import it by clicking open a VM.
Then select the FLATCAR VMX file created Virtual Machines.vmx
After loading it, the VM should be available. You can make the desired configurations such as the network adapter etc.
4. Post Installation Basic Flatcar Container Linux Configurations
Once logged in, you can make the DHCP IP settings using systemd-networkd. Create the below file:
sudo vim /etc/systemd/network/static.network
Add the below lines to the file and replace the IP addresses accurately.
[Match]
Name=ens192
[Network]
DHCP=no
Address=192.168.205.18/24
Gateway=192.168.205.1
DNS=8.8.8.8
DNS=192.168.205.1
Save the file and restart the service:
sudo systemctl restart systemd-networkd
Verify the changes:
You can now SSH into the VM using the IP address. The command will have the syntax below:
ssh core@IP_Address
Sample Output:
To demonstrate if Flatcar Container Linux is working as desired we will try and spin a simple HelloWorld docker container.
sudo docker run hello-world
Sample output:
Voilá! We can all agree that Flatcar Container Linux is working as desired. You can now proceed and use it t deploy desired workloads.
Interested in more?