Forked from krisnod/gist:56ff894f400cce7c742fb11fb2fde9cf
Last active
February 13, 2020 20:34
-
-
Save rhessing/299890e2e3c223208672986bc3cba493 to your computer and use it in GitHub Desktop.
RancherOS on Hetzner
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
How to install RancherOS without software Raid on a Hetzner server. For Raid please see the fork source. | |
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 -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.5.5 --command-line="rancher.password=12345" /mnt/boot/vmlinuz-4.14.138-rancher | |
* Open second SSH connection to live booted RancherOS using "rancher" as an user and "12345" as an password | |
* create cloud-config.yml file (vi cloud-config.yml), for example you can use and adjust the following: | |
* RancherOS + Rancher Server cloud config ( CC-rancher_server.yml ) | |
* RancherOS + Rancher agent cloud config ( CC-rancher_agent.yml ) | |
* install RancherOS | |
* 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 | |
* After reboot login with your key and the user rancher, have fun! | |
* Bonus: you can register the agent on a node running a rancher server, just access the web interface, secure it, generate a new agent config string (sudo docker...) and run it on the rancherOS server locally. |
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
hostname: hetzner-host | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAQQQQAQABKJBSJDVSDSdasdAoX5IULCp[.....]N8z70d4A3Jcta4^#@bGX rancher@hostname | |
mounts: | |
- ["/dev/nvme1n1", "/data", "ext4", ""] | |
runcmd: | |
- mkdir -p /data/user_docker/rancher_server | |
rancher: | |
user_docker: | |
tls: true | |
tls_args: | |
- "--tlsverify" | |
- "--tlscacert=/etc/docker/tls/ca.pem" | |
- "--tlscert=/etc/docker/tls/server-cert.pem" | |
- "--tlskey=/etc/docker/tls/server-key.pem" | |
- "-H=0.0.0.0:2376" | |
storage_driver: overlay2 | |
services: | |
rancher-server: | |
image: rancher/server:stable | |
ports: | |
- "8080:8080" | |
networks: | |
- host | |
restart: unless-stopped | |
volumes: | |
- /data/user_docker/rancher_server:/var/lib/mysql | |
network: | |
dns: | |
nameservers: | |
- 8.8.8.8 | |
- 8.8.4.4 | |
interfaces: | |
eth0: | |
address: 95.216.25.300/26 | |
gateway: 95.216.25.1 | |
mtu: 1400 | |
dhcp: false |
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
hostname: hetzner-host | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAQQQQAQABKJBSJDVSDSdasdAoX5IULCp[.....]N8z70d4A3Jcta4^#@bGX rancher@hostname | |
mounts: | |
- ["/dev/nvme1n1", "/data", "ext4", ""] | |
runcmd: | |
- mkdir -p /data/user_docker/rancher_server | |
rancher: | |
user_docker: | |
tls: true | |
tls_args: | |
- "--tlsverify" | |
- "--tlscacert=/etc/docker/tls/ca.pem" | |
- "--tlscert=/etc/docker/tls/server-cert.pem" | |
- "--tlskey=/etc/docker/tls/server-key.pem" | |
- "-H=0.0.0.0:2376" | |
storage_driver: overlay2 | |
services: | |
rancher-agent: | |
image: rancher/agent:v1.2.11 | |
privileged: true | |
command: | |
- "http://<RANCHER-SERVER-IP>:8080/v1/scripts/<RANCHER-REG-TOKEN>" | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
network: | |
dns: | |
nameservers: | |
- 8.8.8.8 | |
- 8.8.4.4 | |
interfaces: | |
eth0: | |
address: 95.216.25.300/26 | |
gateway: 95.216.25.1 | |
mtu: 1400 | |
dhcp: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment