Last active
April 6, 2022 18:46
-
-
Save krisnod/56ff894f400cce7c742fb11fb2fde9cf to your computer and use it in GitHub Desktop.
RancherOS on Hetzner using software RAID (RAID 1)
This file contains 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
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.racher.com/os/v1.4.1/rancheros.iso | |
* mkdir -p /mnt/rancheros | |
* mount -t iso9660 rancheros.iso /mnt/rancheros | |
* cd /mnt/rancheros | |
* kexec --initrd ./boot/initrd-v1.4.1 --command-line="rancher.password=12345" ./boot/vmlinuz-4.14.67-rancher2 | |
* 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) | |
ssh_authorized_keys: | |
- 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.4,1 -t gptsyslinux -c cloud-config.yml -a "rancher.state.mdadm_scan" -d /dev/sda --no-reboot | |
* sudo ros install -i rancher/os:v1.4.1 -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 | |
* Reboot (everything is done) | |
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 |
THANK YOU!!!
Typo:
-- metadata=1.0
-> --metadata=1.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For the first part you only need to do this:
apt-get -y install kexec-tools
wget https://github.com/rancher/os/releases/download/v1.5.5/rancheros.iso && mount -t iso9660 rancheros.iso /mnt && kexec --initrd /mnt/boot/initrd-v1.4.2 --command-line="rancher.password=12345" /mnt/boot/vmlinuz-4.14.73-rancher
Then for non-raid installations just do:
vi cloud-config.yml
sudo dd if=/dev/zero of=/dev/nvme0n1 bs=512 count=1 conv=notrunc && sudo mkdir /dev/sr0 && sudo ros install -i rancher/os:v1.5.5 -t gptsyslinux -c cloud-config.yml -d /dev/nvme0n1 -f
This cloud config yml should get you started (Hetzner likes the MTU to be set to 1400):
Example for when you are using a vswitch (RancherOS / cloud config with vlan support):
Please note that docker will not start until you add the certificates:
https://rancher.com/docs/os/v1.2/en/configuration/setting-up-docker-tls/