Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ncerovac/c6b61d586bbb7d492aa1abaf9a065876 to your computer and use it in GitHub Desktop.
Save ncerovac/c6b61d586bbb7d492aa1abaf9a065876 to your computer and use it in GitHub Desktop.
RancherOS on Hetzner using software RAID (RAID 1)
Install:
----------
* Activate Hetzner Rescue System (Debian)
* Connect to Hetzner Rescue System using SSH and live boot RancherOS
(thanks goes to William Fleurant for showing how this can be done: https://github.com/wfleurant/boot-rancheros-hetzner/)
* apt-get update
* apt-get install kexec-tools aria2
* aria2c https://releases.rancher.com/os/v1.5.5/rancheros.iso
* mkdir -p /mnt/rancheros
* mount -t iso9660 rancheros.iso /mnt/rancheros
* cd /mnt/rancheros
* kexec --initrd ./boot/initrd-v1.5.5 --command-line="rancher.password=12345" ./boot/vmlinuz-4.14.138-rancher
* Open second SSH connection to live booted RancherOS using "rancher" as an user and "12345" as an password
* reset partition tables
* sudo fdisk /dev/sda
* create a new empty GPT partition table and write it to disk (g + w)
* sudo fdisk /dev/sdb
* create a new empty GPT partition table and write it to disk (g + w)
* create cloud-config.yml file (vi cloud-config.yml)
(add lines below)
#cloud-config
ssh_authorized_keys:
- <this represent your keys so copy paste all in your .pub key file smth like "ssh-ed25519 ...">
* fix installer error with non-existing /dev/sr0 device
* sudo mkdir /dev/sr0
* install RancherOS on both hard drives
* sudo ros install -i rancher/os:v1.5.5 -t gptsyslinux -c cloud-config.yml -a "rancher.state.mdadm_scan" -d /dev/sda --no-reboot
* sudo ros install -i rancher/os:v1.5.5 -t gptsyslinux -c cloud-config.yml -a "rancher.state.mdadm_scan" -d /dev/sdb --no-reboot
* create raid array
* sudo mdadm --create /dev/md0 --level=1 --metadata=1.0 --raid-devices=2 /dev/sda1 /dev/sdb1
* fix filesystem size (if necessary)
* sudo fsck /dev/md0
* sudo resize2fs /dev/md0
* sudo fsck /dev/md0
* check if cloud-config.yml copied your keys
* go to /var/lib/rancher/conf/ and open cloud-config.yml if you don't see content of your previous created cloud-config.yml just copy it manually and save. This was a mayor problem for me so I could ssh via my private key
* Reboot (everything is done)
* try to ssh again to rancher
Upgrade RancherOS:
--------------------
* sudo ros os upgrade --append "rancher.state.mdadm_scan"
Add or replace hard drive (/dev/sdX):
---------------------------------------
* reset partition table
* sudo fdisk /dev/sdX
* create a new empty GPT partition table and write it to disk (g + w)
* install RancherOS on new hard drive
* sudo ros install -i rancher/os:v1.4.1 -t gptsyslinux -c /var/lib/rancher/conf/cloud-config.yml -a "rancher.state.mdadm_scan" -d /dev/sdX --no-reboot
* fix filesystem size (if necessary)
* sudo fsck /dev/md0
* sudo resize2fs /dev/md0
* sudo fsck /dev/md0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment