Nomad Setup

Nomad Setup

In my previous post I talked about why I’m going for Nomad instead of any other cool container orchestration platform. In this post I will be showing you how I created my single node cluster.

As mentioned I’m building a single node cluster. Setting up a multi-region cluster sounds cool and fun to do. It is however a bit of an overkill for my setup. When my server crashes, I will simply reboot and if my house burns down, I have other things to do then fix my server. Although my wife will scream death and murder when the Internet goes down (I will tell you later why my internet won’t work when my nomad server is on fire), I have decided to create a single node cluster which I will run on my server. In my case it was a clean install with just the Ubuntu OS on it.

Now before I describe the how, I will first explain something about the what we are going to install.

If you look at the architecture of Nomad, you can see that it consists of two main components. You have your server and your clients.


The server(s) are the brains of the beast. They manage everything in your cluster. They will make sure your cluster is up and running, schedule tasks, basically everything needed to have a smooth operation. Now on its own a server can’t do anything. It will not run any docker containers for you. For this it needs clients. While the server is the brains of the operation, the clients perform the actual work.

When comparing it to the Kubernetes terminology, the server is the master server and the clients are the worker nodes.


Installing nomad is relatively easy, “you only have to” download the agent and enter some commands to install it. Normally when I say “you only have to” my colleagues start sweating because I tend to understate the amount of work sometimes. But in this case, it is easy to do (if you have some basic Linux knowledge)!

In order to install, go to the following page. This contains the deployment guide of a production node. With some tinkering and small adjustments, you can get it to work for a single node cluster.

For a detailed explanation go to the link, for the short and quick guide continue your reading here:

The first step is to download the sources.

export NOMAD_VERSION=”<insert_latest_version_here>”
unzip nomad_${NOMAD_VERSION}
sudo chown root:root nomad
sudo mv nomad /usr/local/bin/
nomad version

If all went according to plan, you should see the version of your nomad installation printed in your command line!

That is all folks. We have just installed the nomad agent!

The next step would be to add nomad to your systemd configuration so that it is automatically started on boot of your server.


sudo vi /etc/systemd/system/nomad.service

And add the following to the file:


ExecReload=/bin/kill -HUP $MAINPID 
ExecStart=/usr/local/bin/nomad agent -config /etc/nomad.d 


Alright now that that is in place, we must make sure our nomad installation is configured to our liking. This is where we make some small adjustments to the configuration. First, we must set the generic configuration. As you can see in the in the configuration of your “nomad.service’ file the config should be located at /etc/nomad.d.

Create the following file:

sudo vi /etc/nomad.d/nomad.hcl

And add the following:

datacenter = "<insert-cool-name-here>" 
data_dir = "/opt/nomad" 
enable_syslog = true

The last is for some syslog because sometimes you just want to debug something.

Next up is the server configuration, in the same location edit the file:

sudo vi /etc/nomad.d/server.hcl

server {
    enabled = true
    bootstrap_expect = 1
plugin "docker" {
    config {
        allow_privileged = true
        allow_caps = ["ALL"]

Set the “bootstrap_expect” to 1. If you see errors that indicate no master could be picked because of a quorum couldn’t be reached you have forgotten to put it to 1. In a single node cluster, there can be only 1 master.

As you can see, the driver configuration goes here as well. In my case I need to be able to run privileged containers and the default caps weren’t enough for me, so I needed to set it to ALL.

Last step is to configure the client. As you might have expected we need to create the file:

sudo vi /etc/nomad.d/client.hcl

client {
    enabled = true

Easy does it!

Now the final part is making sure nomad is running and keeps on running:

sudo systemctl enable nomad 
sudo systemctl start nomad 
sudo systemctl status nomad

That’s all! You should have your single node cluster up and running! Check it out at the following url:


Nomad Setup

If you don’t see something like this (minus the running tasks), you have a problem to solve! Your first entry for debugging should be the journalctl of your server (we enabled the syslog for a reason!)

In my next post I will show you how to create new Jobs and what I had to do to get it working on my local machine, so stay tuned!