CoreOS on Citrix XenServer 7 Setup Guide

This article applies to Citrix XenServer 7, for version 6.5 please ensure you are using the correct supplemental pack

Installing the Supplemental Pack

SSH into your XenServer host and run the following to download the ISO

wget http://downloadns.citrix.com.edgesuite.net/11621/XenServer-7.0.0-xscontainer.iso

Next run the following command to install it

xe-install-supplemental-pack XenServer-7.0.0-xscontainer.iso

Once this is installed you can rm the iso from dom0 to conserve space.

 

Installing CoreOS Guest

Use the new VM wizard selecting the CoreOS ISO when prompted for the install media and when you get to the final portion where it asks you to complete the cloud-config template ensure you enter a hostname in the top line, and uncomment the line for ssh-rsa and add a key, or you will not be able to SSH into the VM. Once the VM is booted you will see the ip address in the console, attempt to ssh to this using the username core@ipaddress to ensure your SSH key is working.

If your SSH key does not work at this point power off the VM and fix it before proceeding to the next step as it is the point of no return.

 

Installing CoreOS to Disk

SSH to your CoreOS VM. The command below will complete the installation of CoreOS to disk on your VM:

sudo coreos-install -d /dev/xvda -o xen -C stable

Once this completes you will need to execute the following:

sudo reboot

Once the reboot has completed you will need to set a password for the core user

sudo passwd core

Once you provide a password and confirm the password you can proceed to the next step which allows monitoring of containers by dom0

 

Enable Container Monitoring

To enable container monitoring you will first need the UUID of your CoreOS VM. Execute the following command via SSH on your XenServer host:

xe vm-list power-state=running

Copy the UUID over the VM to your clipboard then run the following command:

xscontainer-prepare-vm -v <UUID of VM> -u core

You bill be asked if you’d like to push a pool specific SSH key to the VM for monitoring, choose yes and enter the password you set for the user core in the previous step.

 

Verify Functionality

The next step will be to pull a docker repo of your choice, for my example I will use centos:latest

docker pull centos:latest

Next we will start a docker instance:

docker run -i -t -d centos:latest /bin/bash

At this point we should be to make sure our container is successfully running from the CLI:

docker ps

Now in the Citrix XenCenter console we should see a plus sign next to our CoreOS VM. Once this is expanded you should be able to see the docker container you started by name.

2 comments on “CoreOS on Citrix XenServer 7 Setup Guide

  1. Gilberto de Almeida

    Hi Rstaats

    First of all thanks for your post.

    But I’m getting an error when I run the command xscontainer-prepare-vm. See the output:

    Would you like to push a pool-specific public SSH key into the ~/.ssh/authorized_keys file of the specified VM and therefore authorize hosts in the pool to interact with the containers inside the VM?
    Answer y/n:
    y
    Traceback (most recent call last):
    File “/usr/bin/xscontainer-prepare-vm”, line 272, in
    sys.exit(main())
    File “/usr/bin/xscontainer-prepare-vm”, line 246, in main
    resultcode = _handle_ssh(session, options)
    File “/usr/bin/xscontainer-prepare-vm”, line 139, in _handle_ssh
    resultcode = push_ssh_key(session, options.vmuuid, options.username)
    File “/usr/bin/xscontainer-prepare-vm”, line 80, in push_ssh_key
    print(docker.ERROR_CAUSE_NETWORK)
    AttributeError: ‘module’ object has no attribute ‘ERROR_CAUSE_NETWORK’

    Do you have any clue to give me to find out a solution for this problem?

    Thanks!

    1. rstaats

      Are you able to use the same keys to ssh from the xen host to the guest with a normal ssh command on the cli? The only issues I’ve run into on this is if the authorized_keys or .ssh folder on the VM are not using the correct chmod permissions. Another thing I’ve seen is that unless you’ve ssh’d from the host to that VM before you’ll have to accept the thumbprint or manually add to your known_hosts file.

Leave a Reply

Your email address will not be published. Required fields are marked *

4 × 4 =