# OKD SCOS SNO (Single Node Openshift) install with ABI (Agent Based Installer)
# Prerequisites
* At least 32G of RAM
* libvirt
* virt-install
* virtmanager
I was using Fedora 39
# Figure our the Rendez vous IP
Run the following:
```
sudo virsh net-list
Name State Autostart Persistent
--------------------------------------------
default active no yes
```
## Case where network default doesnt exist
In case `default` is not available, you can create it.
1. If you already have a virbr0 interface, remove it
```
brctl show
sudo ip link set virbr0 down
sudo brctl delbr virbr0
sudo virsh net-destroy default
sudo virsh net-undefine default
```
3. Recreate the default network
add the following line to `/etc/libvirt/libvirt.conf`
uri_default = "qemu:///session"
```
sudo service libvirtd restart
sudo virsh net-define /usr/share/libvirt/networks/default.xml
sudo virsh net-start default
sudo virsh net-list
```
## Run a VM to guess the IP
* Download an [SCOS ISO](https://okd-scos.s3.amazonaws.com/okd-scos/builds/413.9.202303170607-0/x86_64/scos-413.9.202303170607-0-live.x86_64.iso)
* Create a VM
```
virt-install --connect qemu:///system -n agent-installer -r 24000 --vcpus 8 --cdrom /home/skhoury/go/src/github.com/openshift/okd-iso/scos-413.9.202303170607-0-live.x86_64.iso --disk pool=default,size=120 --boot hd,cdrom --os-variant=fedora-coreos-stable --network network=default,mac=52:54:01:dd:dd:d1 --wait=-1&
```
* Using virt-manager, find the IP of the VM, otherwise use:
```
sudo virsh net-dhcp-leases default
Expiry Time MAC address Protocol IP address Hostname Client ID or DUID
-----------------------------------------------------------------------------------------------------------
2023-04-28 20:05:42 52:54:01:dd:dd:d1 ipv4 192.168.122.71/24 master-0 01:52:54:01:dd:dd:d1
```
This is your rendez-vous IP
# Create an Openshift Installer
* Clone or fork the repository https://github.com/openshift/installer/tree/master
* Checkout the PR 7112, using github cli for example
```
gh pr checkout 7112
```
* Build an openshift-install binary
```
TAGS=scos hack/build.sh
```
You'll obtain a binary under bin/openshift-install
# Create the configuration files
agent-config.yaml
```yaml=
apiVersion: v1alpha1
metadata:
name: ostest
namespace: cluster0
rendezvousIP: 192.168.122.71
hosts:
- hostname: master-0
interfaces:
- name: eth0
macAddress: 52:54:01:dd:dd:d1
```
install-config.yaml
```yaml=
apiVersion: v1
baseDomain: test.metalkube.org
compute:
- hyperthreading: Enabled
name: worker
replicas: 0
architecture:
controlPlane:
architecture:
hyperthreading: Enabled
name: master
replicas: 1
metadata:
name: ostest
namespace: cluster0
networking:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 24
machineNetwork:
- cidr: 192.168.122.0/24
serviceNetwork:
- 172.30.0.0/16
networkType: OVNKubernetes
platform:
none: {}
pullSecret: 'contents of pull-secret'
sshKey: |
ssh-rsa AAAAB3xyz skhoury@ubuntu
```
# Create the agent image
rm -fr /tmp/agent/; mkdir /tmp/agent/;cp agent-config.yaml /tmp/agent; cp install-config.yaml /tmp/agent/
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE=registry.ci.openshift.org/origin/release-scos:4.14.0-0.okd-scos-2023-04-28-124102 ./bin/openshift-install agent create image --dir=/tmp/agent --log-level=debug
# Boot the agent image
virt-install --debug --connect qemu:///system -n agent-installer -r 24000 --vcpus 8 --cdrom /tmp/agent/agent.x86_64.iso --disk pool=default,size=120 --boot hd,cdrom --os-variant=fedora-coreos-stable --network network=default,mac=52:54:01:dd:dd:d1 --wait=-1&
sudo virt-install --debug --connect qemu:///system -n agent-installer -r 24000 --vcpus 8 --cdrom /tmp/agent/agent.x86_64.iso --disk pool=default,size=120 --boot hd,cdrom --os-variant=fedora-coreos-stable --network network=default,mac=52:54:01:dd:dd:d1 --wait=-1
# Wait for install to finish
./bin/openshift-install agent wait-for install-complete --log-level=debug --dir /tmp/agent/
ssh -i "openshift-dev" core@192.168.122.71
journalctl -u assisted-service.service > /tmp/log
```
May 10 12:56:39 master-0 service[2493]: time="2023-05-10T12:56:39Z" level=error msg="Failed to register InfraEnv ostest with id cc9aa117-75a4-4dc1-aa65-8b0b6165c776. Error: No OS image for Openshift version 4.13.0-0.okd-scos-2023-04-09-131534 and architecture x86_64: The requested OS image for version (4.13.0-0.okd-scos-2023-04-09-131534) and CPU architecture (x86_64) isn't specified in OS images list" func="github.com/openshift/assisted-service/internal/bminventory.(*bareMetalInventory).RegisterInfraEnvInternal.func1" file="/src/internal/bminventory/inventory.go:4377" cluster_id=cc9aa117-75a4-4dc1-aa65-8b0b6165c776 go-id=101 pkg=Inventory request_id=e8f7b2d4-2cf8-400f-b23f-786745f05724
```
# Using the miniagent script
https://github.com/andfasano/miniagent/blob/okd/sno-setup.sh
export REGISTRY_AUTH_FILE=$XDG_RUNTIME_DIR/containers/auth.json
mkdir $XDG_RUNTIME_DIR/containers
cp ~/Downloads/pull-secret\(3\) $XDG_RUNTIME_DIR/containers/auth.json
CUSTOM_INSTALLER_PATH=`pwd`/bin ./sno-setup.sh registry.ci.openshift.org/origin/release-scos:4.14.0-0.okd-scos-2023-05-23-224540
* Working dir set to /tmp/agent-f7x