Run Unikernel applications on VMware vSphere with UniK
words - read.

Run Unikernel applications on VMware vSphere with UniK

Unikernel applications form a new way to bundle your applications directly in a lightweight kernel. Your application is cross-compiled with a kernel in which only the necessary features needed for your application to run are embedded. The result is a very light footprint and an image that is very fast to boot. To give you an idea of the footprint of a Unikernel application, we are talking in Kilobytes here! There are many different types of Unikernel that are listed on the website. The most famous of them are MirageOS and Rump.

UniK is a tool which facilitates the building and the deployment of Unikernel images on different cloud infrastructures like OpenStack, AWS, or VMware vSphere. To do so, the UniK project uses a Docker like command line interface.

UniK Logo


To deploy and use UniK on VMware vSphere, we will use a Ubuntu 16.04 virtual machine. This machine needs to run on a DHCP network and this network needs to be able to communicate with the VMware vSphere management network, as UniK will send commands over the VMware vCenter API.

Installation of Docker CE

1- Add the Docker GPG key.

$ curl -fsSL | \
sudo apt-key add -

2- Add the Docker repository.

$ sudo add-apt-repository \
   "deb [arch=amd64] \
   $(lsb_release -cs) \

3- Update the Ubuntu 16.04 package index.

$ sudo apt-get update

4- Install Docker CE.

$ sudo apt-get install docker-ce

5- Add your user to the docker group.

$ sudo usermod -aG docker $USER

6- Enable Docker CE.

$ sudo systemctl enable docker

7- Logout and log back into the Ubuntu 16.04 virtual machine.

8- Verify the Docker CE installation.

$ docker info

Installation of Unik

1- Install the UniK dependencies.

$ sudo apt-get install jq make

2- Clone the UniK source code from GitHub.

$ git clone

Note: This version of UniK includes patches regarding the creation of the tmp directory and regarding the CPU usage of the instance listener. If you would like to use the official version please clone

3- Go to the unik directory.

$ cd unik

4- Compile the UniK source code.

$ make

5- Add the UniK binary directory to your PATH.

$ vim ~/.profile

6- Source your profile.

$ source ~/.profile

7- Verify your installation of UniK.

$ unik help

8- Create a directory for the UniK daemon configuration.

$ mkdir ~/.unik

9- Create a configuration file for the UniK daemon.

$ vim ~/.unik/daemon-config.yaml
    - name: vsphere-01
      vsphere_user: administrator@vsphere.local
      vsphere_password: [your_vsphere_password]
      datastore: Datastore-01
      datacenter: inkubate-lab
      network: VM Network

8- Deploy the instance listener on VMware vSphere and start the daemon.

$ unik daemon

Installation of Golang

These steps are optional. We are going to build a Golang application and you only need to install Golang on the Ubuntu 16.04 virtual machine if you would like to test or debug the application locally.

1- Leave the daemon running and open a new session on the Ubuntu 16.04 virtual machine.

2- Download Golang

$ sudo curl -O

3- Extract the archive.

$ sudo tar xvzf go1.8.linux-amd64.tar.gz

4- Move the Golang binary to /usr/local.

$ sudo mv go /usr/local

5- Add the Golang environment to your PATH.

$ vim ~/.profile

6- Source your profile.

$ source .profile

Build a Unikernel application

1- Create a UniK client configuration file.

$ unik target --host localhost

2- Create a directory for the application source code.

$ mkdir -p ~/dev/go-httpd

3- Go to the application directory.

$ cd ~/dev/go-httpd

4- Create the httpd.go file.

$ vim httpd.go
package main
import (

func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }

func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello Unikernel!") }

5- Test the application on the Ubuntu 16.04 virtual machine. Golang must be installed as described in the previous steps.

$ go run httpd.go

6- Browse to http://[your_ubuntu_vm_ip]:8080.

7- Kill the application with Ctrl+C.

8- Create the Godeps directory.

$ mkdir Godeps

9- Create a file to declare the application dependencies (we have none in this example).

$ vim Godeps/Godeps.json
    "ImportPath": "go-httpd",
    "GoVersion": "go1.6",
    "GodepVersion": "v63",
    "Packages": [
    "Deps": [
            "ImportPath": "",
            "Rev": "f8cc0dd435de36377eac060c93481cc9f3ae9688"

10- Build the Unikernel application.

$ unik build --name go-httpd \
--path ~/dev/go-httpd \
--base rump \
--language go \
--provider vsphere

11- Verify that your application image was created.

$ unik images

You should see an image named "go-httpd".

Run the Unikernel application

1- Deploy the application on VMware vSphere.

$ unik run --instanceName go-httpd-01 --imageName go-httpd

2- Verify that a go-httpd-01 virtual machine was created in your VMware vSphere environment.

3- Verify that UniK knows about your new application.

$ unik instances

You should see an instance named "go-httpd-01" and the state of the application should be "running".

4- Gather information regarding the instance of the application.

$ unik describe-instance --instance go-httpd-01

It should display the IP of the instance.

5- Browse to http://[your_instance_ip]:8080.


If you browse to the datastore that you chose in the UniK daemon configuration file, you will find a directory named "unik". Inside this directory, you will find an "images" directory with all the images that you built. If you have a look at the size of the go-httpd application that we just created, it is only 61KB!

If we had deployed the same application on a generic operating system, the size of the image would have been a couple of GB.

As you can see, Unikernel technology can have an important impact on the workload footprint that we are currently running in production. Of course, not all of our current applications would be good candidates to run as Unikernel, but, if we can optimize certain workload with Unikernel, it will leave more resources for our traditional applications.


comments powered by Disqus