In our previous guide, we learned how to install Flatcar Container Linux on VMware Workstation. Today we will walk through how to install Flatcar Container Linux in Proxmox VE.
Flatcar is a container-optimized Linux distribution that ships a minimal OS image with all the necessary tools to spin a container. It can be used to perform optimizations for containerized workloads with thinner sizes than typical Linux systems.
Flatcar was developed as a fork of CoreOS Container Linux when Red Hat purchased CoreOS. It is maintained by Berlin startup Kinfolk. This distro does not have a package manager and is formed by systemd unit files as the building blocks. Each process here is packaged and deployed as a unit. The deployment can be done as part of the installation and managed later using the standard systemctl
tool.
The nifty features provided by Flatcar Container Linux are:
- Minimal OS image that only consists of the tools needed to run containers. No package manager, and no configuration drift.
- Automated atomic updates guarantee you the latest security updates and open-source technologies.
- OS is delivered on an immutable filesystem, eliminating a whole category of security vulnerabilities.
Flatcar Container Linux is officially supported in IaaS environments that include AWS, Azure, Google Cloud, and Equinix Metal. You can easily spin the VM on your local workstation or in the cloud. During the provisioning, you need to be aware of the following 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:
- create and manage storage devices, file systems, and swap, and create custom files
- add custom users and groups
- customise automatic updates and define reboot windows
- create custom network(d) configurations and systemd units
Let’s plunge in!
Install Flatcar Container Linux in Proxmox VE
For this guide, you need to have Proxmox installed. To achieve this, you can use the below guides:
- How To Install Proxmox VE 7 on Debian 11 (Bullseye)
- How To Install Proxmox VE 6 on Debian 10 (Buster)
- Install Proxmox VE 6.x on Hetzner root server
- How To Install Proxmox VE 7 on OVH Dedicated Server
Once Proxmox has been installed, we will proceed as shown.
Step 1: Download Flatcar Container Linux ISO
For Proxmox, we will use an ISO file to do the installation. The latest ISO file can be downloaded from the Flatcar downloads page.
You can also pull the desired ISO file with the command:
##For Stable Channel
curl -LO https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_iso_image.iso
##For Beta Channel
curl -LO https://beta.release.flatcar-linux.net/amd64-usr/current/flatcar_production_iso_image.iso
##For Alpha Channel
curl -LO https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_iso_image.iso
Once downloaded, create a VM on Proxmox and load this ISO file.
Proceed and load the ISO file:
Select the system type.
Configure the network interface and adapter.
Once the VM has been created, leave it off and make the below configs.
Step 2: Install and Configure Apache Web Server
In this guide, we will serve the Ignition file using the Apache web server installed on our host machine or any other machine in the same network.
Apache can be installed with the command:
##On Debian/Ubuntu
sudo apt update && sudo apt install apache2
##On CentOS/Rocky/Alma Linux
sudo yum install -y httpd
Change the listen port to 8080
##On Debian/Ubuntu
sudo sed -i 's/Listen 80/Listen 8080/' /etc/apache2/ports.conf
##On CentOS/Rocky/Alma Linux
sudo sed -i 's/Listen 80/Listen 8080/' /etc/httpd/conf/httpd.conf
sudo setsebool -P httpd_read_user_content 1
Now start and enable the service:
##On Debian/Ubuntu
sudo systemctl enable apache2
sudo systemctl restart apache2
##On CentOS/Rocky/Alma Linux
sudo systemctl enable httpd
sudo systemctl restart httpd
Allow this port through the firewall:
##For UFW
sudo ufw allow 8080
##For Firewalld
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
Verify if the server is running:
curl localhost:8080
Step 3: Create Ignition Config for Flatcar Container Linux
We can go ahead and create an ignition config for the Flatcar Container Linux installation.
vim flatcar.bu
In the file, add the below lines. Remember to replace the SSH keys of your host machine.
variant: flatcar
version: 1.0.0
passwd:
users:
- name: core
ssh_authorized_keys:
- replace-me-with-public-ssh-key
To view the SSH keys on your host machine, use the command:
cat ~/.ssh/id_rsa.pub
Now we will create an ignition file from the Butane config above. This requires butane installed, on Fedora, use the command:
sudo dnf install butane
To make it easier, you can run butane in a container. Install Podman on your system:
- Install Podman on Debian
- Install Podman on Fedora / CentOS / RHEL 7|8
- Install Podman on Ubuntu
- Install Podman on Arch Linux / Manjaro
Run Butane in a container with the command:
podman run --interactive --rm quay.io/coreos/butane:release --pretty --strict < flatcar.bu > flatcar.ign
After this, you will have an ignition file. View it with the command:
$ cat flatcar.ign
{
"ignition": {
"version": "3.3.0"
},
"passwd": {
"users": [
{
"name": "core",
"sshAuthorizedKeys": [
"ssh-rsa AAAAB3N**********UFdnz38thkLc3AnU1OBtsVx3GQZDuxTfOFD9wFdCgY1Ak42BcXtCcAr338ebQC58z3iZ349grkoCvMBtk47Xy7s= [email protected]"
]
}
]
}
}
We will move this file to the Apache web root directory.
sudo mkdir /var/www/html/flatcar
sudo cp flatcar.ign /var/www/html/flatcar
To test if everything is okay, use the command:
$ curl localhost:8080/flatcar/flatcar.ign
{
"ignition": {
"version": "3.3.0"
},
"passwd": {
"users": [
{
"name": "core",
"sshAuthorizedKeys": [
"ssh-rsa AAAAB3N**********UFdnz38thkLc3AnU1OBtsVx3GQZDuxTfOFD9wFdCgY1Ak42BcXtCcAr338ebQC58z3iZ349grkoCvMBtk47Xy7s= [email protected]"
]
}
]
}
}
Step 4: Install Flatcar Container Linux on Proxmox VE
We will now boot into the Flatcar Container Linux live mode.
Once started, access the VM’s console on Proxmox.
Identify the available disk.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 294.8M 0 loop /usr
sda 8:0 0 25G 0 disk
sr0 11:0 1 351M 0 rom
We can then perform the installation on the hard disk. We will use the flatcar-install
script with some other environment variables. This script will destroy everything on the target disk before installing the new Flatcar Container Linux OS.
To view the variables, use the command:
flatcar-install
Ensure that the VM is able to communicate with the host running apache to be able to pull the ignition config. Pull the ignition config:
curl -LO http://192.168.205.4:8080/flatcar/flatcar.ign
In this guide, we will install Flatcar Container Linux on /dev/sda using the downloaded ignition file.
sudo flatcar-install -d /dev/sda -i flatcar.ign
Sample Output:
Once the installation is complete, we will unmount the ISO file and reboot the VM to see if all went as desired.
sudo reboot -i
The system will boot as shown.
Step 5: Post-Install Flatcar Container Linux Configurations
Now SSH into the VM using the copied keys. The command will have the syntax:
ssh core@IP_Address
Use the IP provided for your Flatcar Container Linux VM. If all is okay, you will see this.
Confirm primary interface name of the VM:
ip ad
Now set a static IP address for your VM.
$ sudo vi /etc/systemd/network/static.network
[Match]
Name=eth0
[Network]
DHCP=no
Address=192.168.205.19/24
Gateway=192.168.205.1
DNS=8.8.8.8
DNS=192.168.205.1
Restart the service:
sudo systemctl restart systemd-networkd
Now SSH into the VM again using the set IP and then check if the static Ip has been set:
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether e2:07:f3:1b:f0:5f brd ff:ff:ff:ff:ff:ff
altname enp0s18
altname ens18
inet 192.168.205.19/24 brd 192.168.205.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::e007:f3ff:fe1b:f05f/64 scope link
valid_lft forever preferred_lft forever
Now you can shut down the VM and create a snapshot or template from the VM for future installations.
To test if the VM is working properly, try running a docker container with the command:
sudo docker run hello-world
Sample output:
Step 6: Run Kubernetes on Flatcar Container Linux
You can set up a Kubernetes cluster using aid obtained from the guide below:
- Deploy Kubernetes on KVM using Flatcar Container Linux – Jump to Step 4 – Deploy Kubernetes Cluster using Kubespray
The end!
We have successfully walked through installing Flatcar Container Linux in Proxmox VE. Now you can use Flatcar Container Linux to spin up containers as desired. I hope this was important to you.
See more.