Created
March 12, 2021 10:34
-
-
Save ralvares/4e4432a49bc0f3ebcc825b18a09ddf23 to your computer and use it in GitHub Desktop.
OCP IPI - BM - Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wget https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 | |
| qemu-img create -f qcow2 -b /var/lib/libvirt/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 /var/lib/libvirt/images/provisioner.qcow2 120G | |
| virt-resize --expand /dev/vda1 /var/lib/libvirt/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 /var/lib/libvirt/images/provisioner.qcow2 | |
| virt-customize -a /var/lib/libvirt/images/provisioner.qcow2 --root-password password:Redhat01 --uninstall cloud-init \ | |
| --hostname provisioner.ocp.ralvares.com \ | |
| --run-command 'yum update -y' | |
| virt-customize -a /var/lib/libvirt/images/provisioner.qcow2 --selinux-relabel | |
| virt-install -q -n provisioner \ | |
| --vcpus 8 -r 16384 \ | |
| --os-type linux --os-variant rhel8.0 \ | |
| --disk path=/var/lib/libvirt/images/provisioner.qcow2,bus=scsi,size=120 \ | |
| --network bridge=provisioning,model=virtio,mac=52:54:00:67:2c:16 \ | |
| --network bridge=baremetal,model=virtio,mac=52:54:00:0d:7b:0c \ | |
| --cpu host-passthrough \ | |
| --graphics vnc --console pty,target_type=serial --noautoconsole --import | |
| nmcli connection modify Wired\ connection\ 1 con-name enp1s0 | |
| nmcli connection modify Wired\ connection\ 2 con-name enp2s0 | |
| export PROV_CONN=enp1s0 | |
| export PUB_CONN=enp2s0 | |
| nohup bash -c """ | |
| nmcli con down "$PUB_CONN" | |
| nmcli con delete "$PUB_CONN" | |
| nmcli connection add ifname baremetal type bridge con-name baremetal | |
| nmcli con add type bridge-slave ifname "$PUB_CONN" master baremetal | |
| nmcli con down baremetal | |
| nmcli con up baremetal | |
| nmcli con down "$PROV_CONN" | |
| nmcli con delete "$PROV_CONN" | |
| nmcli connection add ifname provisioning type bridge con-name provisioning | |
| nmcli con add type bridge-slave ifname "$PROV_CONN" master provisioning | |
| nmcli connection modify provisioning ipv4.addresses 172.22.0.1/24 ipv4.method manual | |
| nmcli con down provisioning | |
| nmcli con up provisioning | |
| """ | |
| vim pull-secret.txt | |
| export VERSION=latest-4.5 | |
| export RELEASE_IMAGE=$(curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$VERSION/release.txt | grep 'Pull From: quay.io' | awk -F ' ' '{print $3}') | |
| export cmd=openshift-baremetal-install | |
| export pullsecret_file=~/pull-secret.txt | |
| export extract_dir=$(pwd) | |
| curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$VERSION/openshift-client-linux.tar.gz | tar zxvf - oc | |
| cp oc /usr/local/bin | |
| oc adm release extract --registry-config "${pullsecret_file}" --command=$cmd --to "${extract_dir}" ${RELEASE_IMAGE} | |
| cp openshift-baremetal-install /usr/local/bin | |
| Create Maste Disks 120GB | |
| qemu-img create -f qcow2 /var/lib/libvirt/images/master-0.qcow2 120G | |
| qemu-img create -f qcow2 /var/lib/libvirt/images/master-1.qcow2 120G | |
| qemu-img create -f qcow2 /var/lib/libvirt/images/master-2.qcow2 120G | |
| qemu-img create -f qcow2 /var/lib/libvirt/images/worker-0.qcow2 120G | |
| qemu-img create -f qcow2 /var/lib/libvirt/images/worker-1.qcow2 120G | |
| qemu-img create -f qcow2 /var/lib/libvirt/images/worker-2.qcow2 120G | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.5'><hostname>provisioner.ocp.ralvares.com</hostname></host>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.10'><hostname>api.ocp.ralvares.com</hostname></host>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.12'><hostname>ns1.ocp.ralvares.com</hostname></host>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.20'><hostname>master-0.ocp.ralvares.com</hostname></host>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.21'><hostname>master-1.ocp.ralvares.com</hostname></host>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.22'><hostname>master-2.ocp.ralvares.com</hostname></host>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.30'><hostname>worker-0.ocp.ralvares.com</hostname></host>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.31'><hostname>worker-1.ocp.ralvares.com</hostname></host>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.32'><hostname>worker-2.ocp.ralvares.com</hostname></host>" --live --config | |
| <dnsmasq:options> | |
| <dnsmasq:option value="address=/.apps.ocp.ralvares.com/192.168.122.11"/> | |
| </dnsmasq:options> | |
| virt-install -q -n master-0 \ | |
| --vcpus 4 -r 16384 \ | |
| --os-type linux --os-variant rhel8.0 \ | |
| --disk path=/var/lib/libvirt/images/master-0.qcow2,bus=scsi,size=120 \ | |
| --network bridge=provisioning,model=virtio,mac=52:54:00:99:e7:fb\ | |
| --network bridge=baremetal,model=virtio,mac=52:54:00:23:af:54 \ | |
| --cpu host-passthrough \ | |
| --graphics vnc --console pty,target_type=serial --noautoconsole --print-xml > master-0.xml | |
| virt-install -q -n master-1 \ | |
| --vcpus 4 -r 16384 \ | |
| --os-type linux --os-variant rhel8.0 \ | |
| --disk path=/var/lib/libvirt/images/master-1.qcow2,bus=scsi,size=120 \ | |
| --network bridge=provisioning,model=virtio,mac=52:54:00:f6:7c:e9 \ | |
| --network bridge=baremetal,model=virtio,mac=52:54:00:b0:be:1d \ | |
| --cpu host-passthrough \ | |
| --graphics vnc --console pty,target_type=serial --noautoconsole --print-xml > master-1.xml | |
| virt-install -q -n master-2 \ | |
| --vcpus 4 -r 16384 \ | |
| --os-type linux --os-variant rhel8.0 \ | |
| --disk path=/var/lib/libvirt/images/master-2.qcow2,bus=scsi,size=120 \ | |
| --network bridge=provisioning,model=virtio,mac=52:54:00:01:82:a3 \ | |
| --network bridge=baremetal,model=virtio,mac=52:54:00:de:9e:20 \ | |
| --cpu host-passthrough \ | |
| --graphics vnc --console pty,target_type=serial --noautoconsole --print-xml > master-2.xml | |
| virsh define master-0.xml | |
| virsh define master-1.xml | |
| virsh define master-2.xml | |
| vbmc add master-0 --address 172.22.0.242 --port 623 --username admin --password Redhat01 | |
| vbmc add master-1 --address 172.22.0.243 --port 623 --username admin --password Redhat01 | |
| vbmc add master-2 --address 172.22.0.244 --port 623 --username admin --password Redhat01 | |
| vbmc start master-0 | |
| vbmc start master-1 | |
| vbmc start master-2 | |
| virt-install -q -n worker-0 \ | |
| --vcpus 4 -r 16384 \ | |
| --os-type linux --os-variant rhel8.0 \ | |
| --disk path=/var/lib/libvirt/images/worker-0.qcow2,bus=scsi,size=120 \ | |
| --network bridge=provisioning,model=virtio,mac=52:54:00:f3:2f:c3 \ | |
| --network bridge=baremetal,model=virtio,mac=52:54:00:af:8e:f8 \ | |
| --cpu host-passthrough \ | |
| --graphics vnc --console pty,target_type=serial --noautoconsole --print-xml > worker-0.xml | |
| virt-install -q -n worker-1 \ | |
| --vcpus 4 -r 16384 \ | |
| --os-type linux --os-variant rhel8.0 \ | |
| --disk path=/var/lib/libvirt/images/worker-1.qcow2,bus=scsi,size=120 \ | |
| --network bridge=provisioning,model=virtio,mac=52:54:00:ea:2e:d2 \ | |
| --network bridge=baremetal,model=virtio,mac=52:54:00:91:27:f6 \ | |
| --cpu host-passthrough \ | |
| --graphics vnc --console pty,target_type=serial --noautoconsole --print-xml > worker-1.xml | |
| virt-install -q -n worker-2 \ | |
| --vcpus 4 -r 16384 \ | |
| --os-type linux --os-variant rhel8.0 \ | |
| --disk path=/var/lib/libvirt/images/worker-2.qcow2,bus=scsi,size=120 \ | |
| --network bridge=provisioning,model=virtio,mac=52:54:00:10:a7:ca \ | |
| --network bridge=baremetal,model=virtio,mac=52:54:00:4b:6a:de \ | |
| --cpu host-passthrough \ | |
| --graphics vnc --console pty,target_type=serial --noautoconsole --print-xml > worker-2.xml | |
| virsh define worker-0.xml | |
| virsh define worker-1.xml | |
| virsh define worker-2.xml | |
| vbmc add worker-0 --address 172.22.0.245 --port 623 --username admin --password Redhat01 | |
| vbmc add worker-1 --address 172.22.0.246 --port 623 --username admin --password Redhat01 | |
| vbmc add worker-2 --address 172.22.0.247 --port 623 --username admin --password Redhat01 | |
| vbmc start worker-0 | |
| vbmc start worker-1 | |
| vbmc start worker-2 | |
| Add extra node | |
| qemu-img create -f qcow2 /var/lib/libvirt/images/worker-3.qcow2 120G | |
| virt-install -q -n worker-3 \ | |
| --vcpus 4 -r 16384 \ | |
| --os-type linux --os-variant rhel8.0 \ | |
| --disk path=/var/lib/libvirt/images/worker-3.qcow2,bus=scsi,size=120 \ | |
| --network bridge=provisioning,model=virtio,mac=52:54:00:f3:3f:c4 \ | |
| --network bridge=baremetal,model=virtio,mac=52:54:00:af:9e:f9 \ | |
| --cpu host-passthrough \ | |
| --graphics vnc --console pty,target_type=serial --noautoconsole --print-xml > worker-3.xml | |
| virsh define worker-3.xml | |
| vbmc add worker-3 --address 172.22.0.248 --port 623 --username admin --password Redhat01 | |
| vbmc start worker-3 | |
| ipmitool -I lanplus -U admin -P Redhat01 -H 172.22.0.248 -p 623 power status | |
| virsh net-update baremetal add ip-dhcp-host "<host mac='52:54:00:af:9e:f9' name='worker-3.ocp.ralvares.com' ip='192.168.200.33'/>" --live --config | |
| virsh net-update "baremetal" add dns-host "<host ip='192.168.200.33'><hostname>worker-3.ocp.ralvares.com</hostname></host>" --live --config | |
| echo "/exports/pv-infra-registry 172.16.160.0/24(rw,sync,no_root_squash)" >> /etc/exports | |
| echo "/exports/pv-user-pvs 172.16.160.0/24(rw,sync,no_root_squash)" >> /etc/exports | |
| /usr/bin/podman run -d --name mirror-registry --net host \ | |
| -v /registry/data:/var/lib/registry:z \ | |
| -v /registry/auth:/auth:z \ | |
| -e "REGISTRY_AUTH=htpasswd" \ | |
| -e "REGISTRY_AUTH_HTPASSWD_REALM=registry-realm" \ | |
| -e "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd" \ | |
| -v /registry/certs:/certs:z \ | |
| -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \ | |
| -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \ | |
| quay.io/redhat-emea-ssa-team/registry:2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment