Skip to content

Instantly share code, notes, and snippets.

@karmab
Last active October 4, 2018 16:18
Show Gist options
  • Save karmab/06d8aa015a76de78799e66d0728992d6 to your computer and use it in GitHub Desktop.
Save karmab/06d8aa015a76de78799e66d0728992d6 to your computer and use it in GitHub Desktop.
Deploy latest okd
URI=qemu+tcp://192.168.122.1/system
virsh -c $URI destroy master0
virsh -c $URI undefine master0
virsh -c $URI destroy bootstrap
virsh -c $URI undefine bootstrap
rm -rf /var/lib/libvirt/images/bootstrap* /var/lib/libvirt/images/coreos_base /var/lib/libvirt/images/master* /var/lib/libvirt/images/worker.ign master-0.ign
virsh -c $URI pool-refresh default
virsh -c $URI net-destroy testk
virsh -c $URI net-undefine testk
rm -rf terraform.*
rm -rf /tmp/openshift-install-*
rm -rf ~/.cache/openshift-install
export OPENSHIFT_INSTALL_PLATFORM=libvirt
export OPENSHIFT_INSTALL_BASE_DOMAIN=tt.testing
export OPENSHIFT_INSTALL_CLUSTER_NAME=testk
export OPENSHIFT_INSTALL_PULL_SECRET_PATH=/root/coreos_pull.json
export OPENSHIFT_INSTALL_LIBVIRT_URI=qemu+tcp://192.168.122.1/system
export OPENSHIFT_INSTALL_LIBVIRT_IMAGE=file:///$HOME/rhcos-qemu.qcow2
export OPENSHIFT_INSTALL_EMAIL_ADDRESS=admin@magnifico.es
export OPENSHIFT_INSTALL_PASSWORD=password
export GOPATH=/root/go
yum -y install libvirt-client libvirt-devel gcc-c++ git unzip wget
cp /var/lib/libvirt/images/rhcos-qemu.qcow2 /root/rhcos.qcow2
wget https://dl.google.com/go/go1.11.1.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.11.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin:$GOPATH/src/github/openshift/installer/bin
mkdir -p $GOPATH/{bin,pkg,src}
mkdir -p $GOPATH/src/github.com/openshift
cd $GOPATH/src/github.com/openshift
curl https://glide.sh/get | sh
go get github.com/sgotti/glide-vc
git clone https://github.com/openshift/installer.git
cd installer
rm -f glide.lock
glide install --strip-vendor
glide-vc --use-lock-file --no-tests --only-code
hack/get-terraform.sh
#hack/build.sh
TAGS=libvirt_destroy hack/build.sh
GOBIN=~/.terraform.d/plugins go get -u github.com/dmacvicar/terraform-provider-libvirt
PUBKEY=`cat ~/.ssh/authorized_keys`
echo export OPENSHIFT_INSTALL_SSH_PUB_KEY=\"$PUBKEY\" >> ~/env.sh
source ~/env.sh
# bin/openshift-install cluster --log-level=debug

This deploys latest openshift installer (following https://github.com/openshift/installer/blob/master/docs/dev/libvirt-howto.md)

  • grab rhcos-qemu.qcow2 and put it in home directory

  • prepare libvirt for tcp connections

    • add LIBVIRTD_ARGS="--listen" to /etc/sysconfig/libvirtd
    • open port 16509
    • add the following to /etc/libvirt/libvirtd.conf and restart service
listen_tls = 0
listen_tcp = 1
auth_tcp="none"
tcp_port = "16509"
  • compile
sh okd.sh
  • launch an install
bin/openshift-install cluster --log-level=debug
  • clean failures with the cleanup.sh script (upstream cleanup script deletes all vms....)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment