Lightweight CoreOS Bootable Installer

Appcontainers CoreOS bootable installer that allows a user to quickly boot off of the following mounted ISO file, or disk (if burned), providing a very quick and easy way to install the latest version of CoreOS without having to figure out how to SCP/SSH files around, or learn how to build/create a cloud-config.yaml file. The installer when ran, asks the user a series of questions, and then based on those answers, builds a cloud-config.yaml file for the user, and automatically kicks off an install grabbing the latest version of CoreOS from CoreOS.

From fresh boot to install in under 10 minutes, and the ISO only weighs in at a whopping 67MB!!!

Watch the video below to see a full demo of the installer being ran on a VM/BM machine in order to install CoreOS!!


1. Download the TinyCoreOS-Installer .ISO File

2. Either mount the ISO to a newly created Virtual Machine, or burn off the ISO disk, and insert the Installer disk into a bare metal metal target host.

Note: If you are installing CoreOS on a Virtual Machine, then before starting the VM, Ensure that you go to the settings of the VM and change the network adapter type from NAT to Bridged. This will allow the VM to talk directly on the wire to your network as if it was any other device on your network instead of using Virtual NAT, which can prevent SSH from working correctly.

3. When the boot screen comes up, hit enter to start the boot process or wait for the boot process to automatically start.

4. The installer will boot up, and grab an IP address from your network’s DHCP server, and automatically start SSH. Once the boot process is complete, then your IP and User/Pass credentials are supplied on the screen. There is nothing further to do, other than to go to another machine and SSH into the IP displayed to kick off the actual installer.

Note: If the IP displayed shows 127.0.0.1 then it just means that there may have been a slight delay in contacting your DHCP server. Give it a minute, and then type ifconfig | grep inet in order to refresh and display IPs assigned to the server. Once there is a live network IP available, then nothing further needs to be done, you can proceed with SSHing into the installer from another machine on the network.

Note: If you don't have a DHCP server on your network then you can manually assign the installer an IP address with the following commands

pkill udhcp
ifconfig eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255 up
route add default gw 192.168.0.1
echo nameserver 8.8.8.8 > /etc/resolv.conf

5. Once you have SSHed into the booted installer, you will immediatly be prompted with the CoreOS Installer script. Answer the questions as follows:

  • Hostname – Hostname that you want to assign to the CoreOS Server
  • Username – Username of an admin user that is permitted to log into the CoreOS install, in the event that network is down, or your SSH key is problematic.
  • Password – Password of the admin user.
  • SSH Key – SSH Key that will be used to connect to the CoreOS server as the authentiction mechanism.
  • Note: If you do not already have an SSH Key, then one can simply be generated by typing the following command into a terminal shell:

     ssh-keygen -b 2048 -t rsa 

    Once the Key has been generated then cat the file to copy the public key, to be used on the CoreOS server

    cat /stored/location/id_rsa.pub
  • IP Address – This is the static IP address that you want to assign to the CoreOS Server
  • CIDR – This is the Classless Inter Domain Routing notation of the subnet mask. It defines how many bits from the IP will be used to identify the newtork that the server is attached to. Common CIDR notations are /8 (255.0.0.0), /16 (255.255.0.0), /24 (255.255.255.0), and /32 (255.255.255.255). /24 is the default value.
  • Gateway – IP address of the network gateway.
  • DNS Server – Server used to resolve ip to hostname translations. I typically use Googles nameservers which are 8.8.8.8 and 8.8.4.4.
  • Disk – Disk that CoreOS will be installed on. The Installer will perform a scan of available disks, and show a list of what is available on the server. Refernce the disk you would like by typing its path as in example /dev/sda.
  • Branch – The branch or version of CoreOS that you would like to install. Possible choices are Stable, Beta or Alpha. The default value is set to stable.

6. Verify that all the information is correct and then select either yes (y) or no (n) to either continue with the installation, or go back and re submit answers to the questions that were previously asked.

7. Once (y) is selected, the installer will gather all of the required information, Construct the cloud-config.yaml file, and perform the installation of CoreOS. Once the installation is complete, then the server will be rebooted.

Note: An internet connection is required for this installation, as the installer goes out and grabs a fresh version of CoreOS from CoreOS servers.

8. Once the installation has completed, the server will automatically reboot. At this time, either remove the installer disk from the CD-ROM drive, or go into the VM settings and remove the mounted ISO image. Then let the server reboot normally into CoreOS.

9. When the server has booted, then open an SSH console into the new install using the IP displayed on the console. (It will most likely be the same IP that was assigned to the installer initally).

Note: If CoreOS is assiged the same IP address as the Installer previously had, then you will need to go into your /home/user/.ssh/known_hosts file and remove the key entry.

vim ~/.ssh/known_hosts

Note: If the Key for some reason does not work, then you can fall back to logging into the server using the username/password that you input during the installation process directly in the terminal.

10. Once you have shell access on the CoreOS server, then in order to fix the IP address, grab the adapter name with an ifconfig statement, and ammend the cloud-config file with that adapter name, in the write_files section of the cloud-config.

ifconfig
 
sudo su -
vim /var/lib/coreos-install/user_data

Change:

[Match]
Name=en*

to:

[Match]
Name=enp0s3

Note that enp0s3 is the adapter name in my installation, your install will most likely be different so be sure to type your installs adapter name, not the one used in this example.

11. Save the file.

12. If you have multiple adapters on the box, you can create additional unit files by changing to the systemd network directory, still as the root user, and duplicating the static.network file that currently already exists.

cd /etc/systemd/network
cp 10-static.network 20-static.network

13. On the subsequenet adapters (as many as needed, labeled as 30-statitc.network, 40-static.network, etc..) Again change the adapter name, and remove the Gateway, and DNS parameters unless of course, the host sits on multiple separate subnets.

14. Save the file(s) and reboot the server to ensure the configuration is correct.

15. If the address is still not correct, or 2 adapters have the same IP, it’s just a product of the new cloud-config not having enough time before the initial reboot to modify the static.network files, Just reboot the box a second time, all should be right in the world.

1 comments
westont
westont

Firstly, Your awesome.. 

Secondly, Thank you..!


Thirdly? Is there any chance you have a Kubernetes / CoreOS deployment instructional video on the horizon?