Installing CoreOS on bare metal at OVH
OVH offer powerful servers at quite reasonable cost (last season's servers come at a terrifically low price compared to cloud offerings), but it should be remembered that they don't come with any of the high availability disk or network guarantees EC2 or other cloud providers offer. CoreOS cannot currently install to software RAID (as found on the 2013 server I tested this on) so a regimented backup strategy is essential.
These caveats aside, an OVH server is a good test bed for a CoreOS system. Installing CoreOS is relatively easy.
-
Navigate to the OVH control panel (
Dedicated -> Infrastructure) -
Under
General informationclickReinstalland choose an OVH template -
Provision any OS (it's not going be used so something small like
Arch Linux (autoinstaller, latest version)is a good choice) -
Tick the checkbox
Customise the partition configuration -
Select
1from theDisks used for this installationdropdown (to avoid software RAID) -
Leave the default partitions, proceed to the final step and click
Confirm -
After provisioning, click
Modify(next toBoot) and set the machine to boot into rescue mode -
Restart the machine using the button in the top right corner
-
ssh into the machine from the password emailed too you
-
Get an etcd discovery token from https://discovery.etcd.io/new
-
Configure your cloud-config script
$ cat <<EOF > ./cloud-config
#cloud-config
hostname: coreos1
ssh_authorized_keys:
- ssh-rsa <insert your key here>
users:
- name: andy
groups:
- sudo
- docker
coreos-ssh-import-github: sublimino
coreos:
etcd:
name: node001
discovery: https://discovery.etcd.io/<your-new-etcd-key>
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
fleet:
public-ip: $public_ipv4
metadata: region=rbx
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: settimezone.service
command: start
content: |
[Unit]
Description=Set the timezone
[Service]
ExecStart=/usr/bin/timedatectl set-timezone UTC
RemainAfterExit=yes
Type=oneshot
write_files:
- path: /etc/resolv.conf
permissions: 0644
owner: root
content: |
nameserver 8.8.8.8
- path: /etc/ntp.conf
content: |
# Common pool
server 0.pool.ntp.org
server 1.pool.ntp.org
# - Allow limited rate time queries only
# - Allow all local queries (IPv4, IPv6)
restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]
EOF
-
Don't forget to edit the
hostname,ssh_authorized_keys,name,coreos-ssh-import-githuband<your-new-etcd-key>keys above or you won't be able to access the system after its installed -
Grab and run the CoreOS installation script
$ wget https://raw.github.com/coreos/init/master/bin/coreos-install && \ chmod +x coreos-install && \ ./coreos-install -d /dev/sda -C stable -c ./cloud-config -
You can now mount the installation disk to ensure everything has been configured correctly
$ mount -o subvol=root /dev/sda9 /mnt $ cat /mnt/var/lib/coreos-install/user_data -
If your config is stored there then the
cloud-configfile has worked and the installation is complete, so go back to the admin console, clickModify(next toBoot) and set the machine to boot from hard disk -
Restart the machine using the button in the top right corner
-
Once the machine is rebooted, you can
sshin$ ssh andy@<server-IP>
(CoreOS also provides a core user to access the machine with, but I prefer individual user accounts)
Finally, check out the docs: