Install

 1# Get latest version
 2OKD_VERSION=$(curl -s https://api.github.com/repos/okd-project/okd/releases/latest | jq -r .tag_name)
 3
 4# Download
 5curl -L https://github.com/okd-project/okd/releases/download/${OKD_VERSION}/openshift-install-linux-${OKD_VERSION}.tar.gz -O
 6curl -L https://github.com/okd-project/okd/releases/download/${OKD_VERSION}/openshift-client-linux-${OKD_VERSION}.tar.gz -O
 7
 8# Download FCOS iso
 9./openshift-install coreos print-stream-json | grep '\.iso[^.]'
10./openshift-install coreos print-stream-json | jq .architectures.x86_64.artifacts.metal.formats.iso.disk.location
11./openshift-install coreos print-stream-json | jq .architectures.x86_64.artifacts.vmware.formats.ova.disk.location
12./openshift-install coreos print-stream-json | jq '.architectures.x86_64.artifacts.digitalocean.formats["qcow2.gz"].disk.location'
13./openshift-install coreos print-stream-json | jq '.architectures.x86_64.artifacts.qemu.formats["qcow2.gz"].disk.location'
14./openshift-install coreos print-stream-json | jq '.architectures.x86_64.artifacts.metal.formats.pxe | .. | .location? // empty'

Install bare-metal

Official doc

 1# Pre-tasks
 2useradd kni
 3echo "kni ALL=(root) NOPASSWD:ALL" | tee -a /etc/sudoers.d/kni 
 4chmod 0440 /etc/sudoers.d/kni
 5su - kni -c "ssh-keygen -t ed25519 -f /home/kni/.ssh/id_rsa -N ''"
 6sudo dnf install -y libvirt qemu-kvm python3-devel jq
 7sudo usermod --append --groups libvirt kni
 8sudo systemctl start firewalld
 9sudo firewall-cmd --zone=public --add-service=http --permanent
10sudo firewall-cmd --reload
11sudo systemctl enable libvirtd --now
12sudo virsh pool-define-as --name default --type dir --target /var/lib/libvirt/images
13sudo virsh pool-start default
14sudo virsh pool-autostart default
15
16# Pull secret (https://console.redhat.com/openshift/install/metal/installer-provisioned)
17su - kni
18vim pull-secret.txt
19
20# Network
21export PUB_CONN="cloud-init eth1"
22nmcli con down "$PUB_CONN"
23nmcli con delete "$PUB_CONN"
24nmcli connection add ifname baremetal type bridge con-name baremetal bridge.stp no
25nmcli con add type bridge-slave ifname "$PUB_CONN" master baremetal
26nohup bash -c "pkill dhclient;dhclient baremetal" &
27
28# retrieve OKD installer
29export VERSION="stable-4.15"
30export RELEASE_ARCH="amd64"
31export RELEASE_IMAGE=$(curl -s https://mirror.openshift.com/pub/openshift-v4/$RELEASE_ARCH/clients/ocp/$VERSION/release.txt | grep 'Pull From: quay.io' | awk -F ' ' '{print $3}')
32
33# Extract OKD installer
34export cmd=openshift-baremetal-install
35export pullsecret_file=~/pull-secret.txt
36export extract_dir=$(pwd)
37curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$VERSION/openshift-client-linux.tar.gz | tar zxvf - oc
38mv oc $HOME/.local/bin
39oc adm release extract --registry-config "${pullsecret_file}" --command=$cmd --to "${extract_dir}" ${RELEASE_IMAGE}
40mv openshift-baremetal-install $HOME/.local/bin
41
42# Create FCOS image cache (usefull for network with limited bandwidth)
43sudo dnf install -y podman
44sudo firewall-cmd --add-port=8080/tcp --zone=public --permanent
45sudo firewall-cmd --reload
46
47mkdir /home/kni/rhcos_image_cache
48sudo semanage fcontext -a -t httpd_sys_content_t "/home/kni/rhcos_image_cache(/.*)?"
49sudo restorecon -Rv /home/kni/rhcos_image_cache/
50
51export RHCOS_QEMU_URI=$(openshift-baremetal-install coreos print-stream-json | jq -r --arg ARCH "$(arch)" '.architectures[$ARCH].artifacts.qemu.formats["qcow2.gz"].disk.location')
52export RHCOS_QEMU_NAME=${RHCOS_QEMU_URI##*/}
53export RHCOS_QEMU_UNCOMPRESSED_SHA256=$(openshift-baremetal-install coreos print-stream-json | jq -r --arg ARCH "$(arch)" '.architectures[$ARCH].artifacts.qemu.formats["qcow2.gz"].disk["uncompressed-sha256"]')
54curl -L ${RHCOS_QEMU_URI} -o ./rhcos_image_cache/${RHCOS_QEMU_NAME}
55
56# Validate httpd_sys_content_t
57ls -Z ./rhcos_image_cache
58
59# Create pod
60podman run -d --name rhcos_image_cache \
61-v rhcos_image_cache:/var/www/html \
62-p 8080:8080/tcp \
63registry.access.redhat.com/ubi9/httpd-24
64
65export BAREMETAL_IP=$(ip addr show dev eth1 | awk '/inet /{print $2}' | cut -d"/" -f1)
66export BOOTSTRAP_OS_IMAGE="http://${BAREMETAL_IP}:8080/${RHCOS_QEMU_NAME}?sha256=${RHCOS_QEMU_UNCOMPRESSED_SHA256}"
67echo "    bootstrapOSImage=${BOOTSTRAP_OS_IMAGE}"