How to install CoreOS on Cloudstack


If your looking to get CoreOS on CloudStack these instructions will show you how.

Adding the CoreOS ISO to CloudStack

  1. Log into CloudStack then goto “Template –> ISO”
  2. Click the “Register ISO” button.
  3. Input the required information.Name: coreos64.isoDescription: CoreOS 64bitURL: http://stable.release.core-os.net/amd64-usr/current/coreos_production_iso_image.isoOS Type: Other (64-bit)
  4. Also make sure that the “Bootable” option is checked. Then click “OK”.

The download will start shortly after. You can check the status of the download by clicking the iso name then clicking the “Zones” tab.

Create the CoreOS vm instance using the iso.

Now that the ISO is ready you can create a vm instance in CloudStack using the CoreOS ISO. Choose a service offering that has at least 1GB of RAM and 1 CPU.

Create SSH key on your linux or Mac OS client

This step shows how to create the SSH key that will be used to log into the CoreOS instance after we’re done.

  1. Run the ssh-keygen command.ssh-keygen -t rsa -b 2048
  2. Enter a filename for the new key. In my example I use “id_rsa_coreos”.
  3. Enter a passphrase to further secure the key.

The output should look similar to this.

 mymbplaptop:cldstk-deploy antoneheyward$ ssh-keygen -t rsa -b 2048
 Generating public/private rsa key pair.
 Enter file in which to save the key (/Users/antoneheyward/.ssh/id_rsa): /Users/antoneheyward/.ssh/id_rsa_coreos
 Enter passphrase (empty for no passphrase):
 Enter same passphrase again:
 Your identification has been saved in /Users/antoneheyward/.ssh/id_rsa_coreos.
 Your public key has been saved in /Users/antoneheyward/.ssh/id_rsa_coreos.pub.
 The key fingerprint is:
 35:71:47:9f:cd:0a:cb:60:59:60:8c:92:d4:c5:74:9b [email protected]
 The key’s randomart image is:
 +–[ RSA 2048]—-+
 | ..o *.+.o |
 | o o.o + oo|
 | . * E .+|
 | o + o . |
 | S o . |
 | |
 | |
 | |
 | |
 +—————–+

Change to root user password in CoreOS

sudo su - root

Get IP address of the CoreOS instance

ifconfig

SSH into the CoreOS instance from your client

ssh [email protected]

Create cloud-config.yaml

vi cloud-config.yaml

From the client get the ssh key then copy it to your clipboard

    mymbplaptop:cldstk-deploy antoneheyward$ cat /Users/antoneheyward/.ssh/id_rsa_coreos.pub
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7M2YucuE50gP5niSFhXc8/oIz7dCvmMFBnFKTrlAKBTwBmAeDQkWABHdbtBI00AY3NxnxJOqY893hmPVMI4g+pRV0dSNhCXybUzxWdPX6knViV3o/CojtJfr1u7HiQe7BGsgsIbKfdoGKWOYd/wh38x58wiR+SGE6hChJwkIKJe/rBNUSKLooyLyYAllnAer4whnjcgaB2J1iOu5+x0KIAoxdbvoIjmFTjWKW6ZEIhmeNHKvIee8l9PC2RrU2Y6jlxjPy1YVOJlQPwFgcKDFwzT+mbCXiNy/x7igrBHvEQgM6yOwCnnytyQZptf8rzmuLNmrxaZ+3dI3Yf/STC4Xt [email protected]

Paste into cloud-config.yaml which we got from above

Add the following to the cloud-config.yaml file.

    #cloud-config
    users:
      - name: coreadmin
        groups:
          - sudo
          - docker
        ssh-authorized-keys:
          - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7M2YucuE50gP5niSFhXc8/oIz7dCvmMFBnFKTrlAKBTwBmAeDQkWABHdbtBI00AY3NxnxJOqY893hmPVMI4g+pRV0dSNhCXybUzxWdPX6knViV3o/CojtJfr1u7HiQe7BGsgsIbKfdoGKWOYd/wh38x58wiR+SGE6hChJwkIKJe/rBNUSKLooyLyYAllnAer4whnjcgaB2J1iOu5+x0KIAoxdbvoIjmFTjWKW6ZEIhmeNHKvIee8l9PC2RrU2Y6jlxjPy1YVOJlQPwFgcKDFwzT+mbCXiNy/x7igrBHvEQgM6yOwCnnytyQZptf8rzmuLNmrxaZ+3dI3Yf/STC4Xt [email protected]

Verify the disk device in the CoreOS instance

ls /dev | grep sd

If you should see the “sda” device that we’ll use in the next commend which begins the installation of CoreOS.

Run the CoreOS install command

coreos-install -d /dev/sda -C stable -c cloud-config.yaml

The installation should not take long. When it’s complete follow the steps below.

A few more steps to go.

  1. Stop/Shutdown the CoreOS instance when the installation is complete.
  2. Detach the iso.
  3. Start the coreos instance.

Log into coreos

Now that all that is done you can now log into the CoreOS instance.
ssh -i ~/.ssh/id_rsa_coreos [email protected]

Customize the instance as required then create a template out of the disk.