kinvolk / racker

rack provisioning utility for Kinvolk projects
Apache License 2.0
14 stars 3 forks source link

bootstrap: recreate node when PXE boot is forced with plain QEMU #89

Closed pothos closed 3 years ago

pothos commented 3 years ago

In the QEMU mode where the prepare.sh script is directly used (i.e., not the Racker QEMU IPMI simulator environment), the reprovisioning with PXE could be only forced when the VM got deleted manually before. Automatically delete any existing VM before creating it.

Fixes https://github.com/kinvolk/racker/issues/42

How to use

cd /var/tmp/
mkdir mycluster # prepare.sh create must run in an empty folder with just the *_macs files
cd mycluster
echo 0c:42:a1:11:11:11 > controller_macs
echo 0c:42:a1:11:11:22 > worker_macs
sudo rm -r /opt/racker/terraform/
sudo mkdir -p /opt/racker/terraform
sudo cp -r /home/$USER/kinvolk/lokomotive/assets/terraform-modules/matchbox-flatcar/* /opt/racker/terraform
# compile the right Lokomotive branch used in Racker
PATH="$PATH:/home/$USER/kinvolk/lokomotive" /home/$USER/kinvolk/racker/bootstrap/prepare.sh create
[…]
PATH="$PATH:/home/$USER/kinvolk/lokomotive" /home/$USER/kinvolk/racker/bootstrap/prepare.sh destroy

Testing done

rm lokoctl-assets/cluster-assets/0c:42:a1:11:11:22 # force a PXE installation when reprovisioning
nano cl/lokomotive-worker-0.k8s.localdomain.yaml # change something in /etc/hosts to force a reprovisioning
PATH="$PATH:/home/$USER/kinvolk/lokomotive" lokoctl cluster apply