B1-2 Matchbox インストールと設定
1. Matchboxについて
Matchboxは、ベアメタルマシンをプロファイルにマッチングして、PXEブートとクラスタのプロビジョニングを行うサービスです。 このツールは、MACアドレスやUUIDなどのラベルを使用してマシンをマッチングし、プロファイルはカーネル/ initrd、iPXE設定、およびIgnition設定を指定します。以下はMatchboxの主な特徴です:
iPXEチェーンロード: iPXEを介してハードウェアラベルをマッチングできます。
Fedora CoreOSまたはFlatcar Linuxのプロビジョニング: Ignitionを使用してFedora CoreOSまたはFlatcar Linuxをプロビジョニングできます。
認証付きgRPC API: クライアント(たとえばTerraform)向けの認証付きgRPC APIがあります。
Matchboxはバイナリまたはコンテナイメージとしてインストールでき、PXE対応のネットワークをセットアップすることができます。Terraformを使用してFedora CoreOSやFlatcar Linuxのマシンをプロビジョニングする方法も提供されています。このツールは、ベアメタルクラスタのネットワークブートとプロビジョニングに役立ちます。【出典:COPILOT】
ということで、Matchboxを使って、OpenShiftのmaster/workerのOSであるRHCOSをVMにネットワークインストールし、続いてにOpenShiftをインストールします、
2. インストール
3. 設定
# pwd
/var/lib/matchbox
# tree .
.
├── assets
│ ├── bootstrap.ign
│ ├── master.ign
│ ├── rhcos-4.15.0-x86_64-live-initramfs.x86_64.img
│ ├── rhcos-4.15.0-x86_64-live-kernel-x86_64
│ ├── rhcos-4.15.0-x86_64-live-rootfs.x86_64.img
│ └── worker.ign
├── groups
│ ├── bootstrap.json
│ ├── master-0.json
│ ├── master-1.json
│ ├── master-2.json
│ ├── worker-0.json
│ ├── worker-1.json
│ └── worker-2.json
├── ignition
└── profiles
├── bootstrap.json
├── master.json
└── worker.json
3.1 groups
- PXE処理を要求するクライアントのMACアドレスで、適用するprofileを決定する
- 1MACアドレスで、1ファイル用意する
# pwd
/var/lib/matchbox/groups
# cat bootstrap.json
{
"id": "bootstrap",
"name": "OCP4 Bootstrap",
"profile": "bootstrap",
"selector": {
"mac": "00:00:00:00:00:22"
}
}
# cat master-0.json
{
"id": "master-0",
"name": "OCP4 Master 0",
"profile": "master",
"selector": {
"mac": "00:00:00:00:00:23"
}
}
# cat worker-0.json
{
"id": "worker-0",
"name": "OCP4 Worker 0",
"profile": "worker",
"selector": {
"mac": "00:00:00:00:00:26"
}
}
3.2 profiles
- プロファイル別にPXEの処理内容が記述されている。
- tftpとhttpを使って、assetに配置されたファイルをクライアントに配信する。
- http://bastion.morifuku.com:8080は、matchboxが提供するhttpサービス。
- http URL形式になってないファイルはtftpが適用される(と思われる)。
# pwd
/var/lib/matchbox/profiles
# cat bootstrap.json
{
"id": "bootstrap",
"name": "OCP4 Bootstrap",
"ignition_id": "bootstrap.ign",
"boot": {
"kernel": "/assets/rhcos-4.15.0-x86_64-live-kernel-x86_64",
"initrd": [
"/assets/rhcos-4.15.0-x86_64-live-initramfs.x86_64.img"
],
"args": [
"ip=dhcp",
"rd.neednet=1",
"coreos.inst=yes",
"coreos.inst.install_dev=/dev/sda",
"coreos.live.rootfs_url=http://bastion.morifuku.com:8080/assets/rhcos-4.15.0-x86_64-live-rootfs.x86_64.img",
"coreos.inst.ignition_url=http://bastion.morifuku.com:8080/assets/bootstrap.ign"
]
}
}
# cat master.json
{
"id": "master",
"name": "OCP4 Master",
"ignition_id": "master.ign",
"boot": {
"kernel": "/assets/rhcos-4.15.0-x86_64-live-kernel-x86_64",
"initrd": [
"/assets/rhcos-4.15.0-x86_64-live-initramfs.x86_64.img"
],
"args": [
"ip=dhcp",
"rd.neednet=1",
"coreos.inst=yes",
"coreos.inst.install_dev=/dev/sda",
"coreos.live.rootfs_url=http://bastion.morifuku.com:8080/assets/rhcos-4.15.0-x86_64-live-rootfs.x86_64.img",
"coreos.inst.ignition_url=http://bastion.morifuku.com:8080/assets/master.ign"
]
}
}
# cat worker.json
{
"id": "worker",
"name": "OCP4 Worker",
"ignition_id": "worker.ign",
"boot": {
"kernel": "/assets/rhcos-4.15.0-x86_64-live-kernel-x86_64",
"initrd": [
"/assets/rhcos-4.15.0-x86_64-live-initramfs.x86_64.img"
],
"args": [
"ip=dhcp",
"rd.neednet=1",
"coreos.inst=yes",
"coreos.inst.install_dev=/dev/sda",
"coreos.live.rootfs_url=http://bastion.morifuku.com:8080/assets/rhcos-4.15.0-x86_64-live-rootfs.x86_64.img",
"coreos.inst.ignition_url=http://bastion.morifuku.com:8080/assets/worker.ign"
]
}
}