kubernetes-bootstrapping/00-provisioning
2023-12-17 22:28:51 -07:00
..
butane add kube-control01, fix race condition and add pixel 6a ssh key 2023-12-17 22:28:51 -07:00
ignition add kube-control01, fix race condition and add pixel 6a ssh key 2023-12-17 22:28:51 -07:00
README.md add kube-control01, fix race condition and add pixel 6a ssh key 2023-12-17 22:28:51 -07:00

00-Provisioning

Adding new nodes

  1. Create a boot and full butane yaml file for the new host in the butane directory
  2. Generate ignition JSON files from butane YAML files using the below snippet
  3. Check the resulting .json files into version control
# Be sure to run from 00-provisioning directory
cd 00-provisioning

# Loop through all butane files and generate ignition files
for i in butane/*.yaml; do
    FILENAME=$( echo $i | cut -c 8- | head -c -6)
    echo running butane on $FILENAME
    butane butane/$FILENAME.yaml > ignition/$FILENAME.json
done

After you've checked the ignition files into version control, provision the server, either on baremetal or VM - example with virtualbox.


# Stop git bash being stupid
export MSYS_NO_PATHCONV=1
# Function to create VirtualBox VM, accepts name of VM as argument
create_vm() {
    if [ -z "$1" ]; then
        echo "error: create_vm() called without specifying a VM name"
        echo "Usage: create_vm <name>"
        return
    fi
    "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" import --vsys 0 --vmname "$1" "D:/VirtualBox/OVA/fedora-coreos-39.20231119.3.0-virtualbox.x86_64.ova"
    "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" modifyvm $1 --nic1 bridged
    "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" modifyvm $1 --bridge-adapter1 "Intel(R) Ethernet Controller I225-V"
    "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" guestproperty set $1 "/Ignition/Config" "$(cat ignition/$1-boot.json)"
    "C:/Program Files/Oracle/VirtualBox/vboxmanage.exe" startvm $1 --type headless
}

create_vm kube-control01
create_vm kube-node01
create_vm kube-node02
create_vm kube-node03