Lab 2.4 - Install OKD Cluster - Setup Matchbox

1. Download and extract Matchbox

curl -LO https://github.com/poseidon/matchbox/releases/download/v0.8.3/matchbox-v0.8.3-linux-amd64.tar.gz
tar xvzf matchbox-v0.8.3-linux-amd64.tar.gz 

2. Move matchbox binary

cd matchbox-v0.8.3-linux-amd64
cp matchbox /usr/local/bin/

3. Create matchbox user for matchbox service

useradd -U matchbox
cat /etc/passwd | grep matchbox

4. Create configuration directory for matchbox

mkdir -p /var/lib/matchbox/{assets,groups,ignition,profiles}
chown -R matchbox:matchbox /var/lib/matchbox
ls /var/lib/matchbox/

5. Create, enable and start matchbox systemd service

cp contrib/systemd/matchbox-local.service /etc/systemd/system/matchbox.service

systemctl daemon-reload
systemctl enable matchbox
systemctl start matchbox
systemctl status matchbox

6. Download Fedora CoreOS assets

cd /var/lib/matchbox/assets

wget https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200907.3.0/x86_64/fedora-coreos-32.20200907.3.0-live-kernel-x86_64 -O fcos-32-kernel
wget https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200907.3.0/x86_64/fedora-coreos-32.20200907.3.0-live-kernel-x86_64.sig -O fcos-32-kernel.sig

wget https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200907.3.0/x86_64/fedora-coreos-32.20200907.3.0-live-initramfs.x86_64.img -O fcos-32-initramfs.img
wget https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200907.3.0/x86_64/fedora-coreos-32.20200907.3.0-live-initramfs.x86_64.img.sig -O fcos-32-initramfs.img.sig 

wget https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200907.3.0/x86_64/fedora-coreos-32.20200907.3.0-metal.x86_64.raw.xz -O fcos-32-metal.raw.xz
wget https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/32.20200907.3.0/x86_64/fedora-coreos-32.20200907.3.0-metal.x86_64.raw.xz.sig -O fcos-32-metal.raw.xz.sig

7. Create Matchbox Bootstrap profiles

vim /var/lib/matchbox/profiles/bootstrap.json
...
{
"id": "bootstrap",
"name": "OKD 4.5 - Bootstrap",
"ignition_id": "bootstrap.ign",
"boot": {
"kernel": "/assets/fcos-32-kernel",
"initrd": ["/assets/fcos-32-initramfs.img"],
"args": [
"ip=dhcp",
"rd.neednet=1",
"console=tty0",
"console=ttyS0",
"coreos.inst=yes",
"coreos.inst.install_dev=vda",
"coreos.inst.image_url=http://helper.openshift.podX.io:8080/assets/fcos-32-metal.raw.xz",
"coreos.inst.ignition_url=http://helper.openshift.podX.io:8080/ignition?mac=${mac:hexhyp}"
]
}
}
...

8. Create Matchbox Master profiles

vim /var/lib/matchbox/profiles/master.json
...
{
"id": "master",
"name": "OKD 4.5 - Master",
"ignition_id": "master.ign",
"boot": {
"kernel": "/assets/fcos-32-kernel",
"initrd": ["/assets/fcos-32-initramfs.img"],
"args": [
"ip=dhcp",
"rd.neednet=1",
"console=tty0",
"console=ttyS0",
"coreos.inst=yes",
"coreos.inst.install_dev=vda",
"coreos.inst.image_url=http://helper.openshift.podX.io:8080/assets/fcos-32-metal.raw.xz",
"coreos.inst.ignition_url=http://helper.openshift.podX.io:8080/ignition?mac=${mac:hexhyp}"
]
}
}
...

9. Create Matchbox Worker profiles

vim /var/lib/matchbox/profiles/worker.json
...
{
"id": "worker",
"name": "OKD 4.5 - Worker",
"ignition_id": "worker.ign",
"boot": {
"kernel": "/assets/fcos-32-kernel",
"initrd": ["/assets/fcos-32-initramfs.img"],
"args": [
"ip=dhcp",
"rd.neednet=1",
"console=tty0",
"console=ttyS0",
"coreos.inst=yes",
"coreos.inst.install_dev=vda",
"coreos.inst.image_url=http://helper.openshift.podX.io:8080/assets/fcos-32-metal.raw.xz",
"coreos.inst.ignition_url=http://helper.openshift.podX.io:8080/ignition?mac=${mac:hexhyp}"
]
}
}
...

10. Create groups for bootstrap node

cat <<EOF >> /var/lib/matchbox/groups/bootstrap.json
{
"id": "bootstrap",
"name": "OKD 4.5 - Bootstrap server",
"profile": "bootstrap",
"selector": {
"mac": "52:54:00:f5:90:ad"
}
}
EOF

11. Create groups for master1 node

cat <<EOF >> /var/lib/matchbox/groups/master1.json 
{
"id": "master1",
"name": "OKD 4.5 - Master 1",
"profile": "master",
"selector": {
"mac": "52:54:00:e4:72:ae"
}
}
EOF

12. Create groups for master2 node

cat <<EOF >> /var/lib/matchbox/groups/master2.json 
{
"id": "master2",
"name": "OKD 4.5 - Master 2",
"profile": "master",
"selector": {
"mac": "52:54:00:21:29:c9"
}
}
EOF

13. Create groups for master3 node

cat <<EOF >> /var/lib/matchbox/groups/master3.json 
{
"id": "master3",
"name": "OKD 4.5 - Master 3",
"profile": "master",
"selector": {
"mac": "52:54:00:12:c3:e1"
}
}
EOF

14. Create groups for worker1 node

cat <<EOF >> /var/lib/matchbox/groups/worker1.json 
{
"id": "worker1",
"name": "OKD 4.5 - Worker 1",
"profile": "worker",
"selector": {
"mac": "52:54:00:79:95:86"
}
}
EOF

15. Create groups for worker2 node

cat <<EOF >> /var/lib/matchbox/groups/worker2.json 
{
"id": "worker2",
"name": "OKD 4.5 - Worker 2",
"profile": "worker",
"selector": {
"mac": "52:54:00:0e:0a:db"
}
}
EOF

16. Set firewalld for matchbox

firewall-cmd --permanent --add-port 8080/tcp
firewall-cmd --reload

Daftar Materi