x

Menu

First steps with HashiCorp Nomad

published in: hashicorp Date: February 15, 2021
Jürgen Brüder, Senior IT-Consultant

About the author

Jürgen Brüder is a Senior IT-Consultant for Infralovers and an IT-Trainer for Commandemy. He was the CTO of the Austrian based big-data startup Xeer and was also active as a consultant for various companies. Twitter LinkedIn

See all articles by this author

Nomad is HashiCorp’s alternative to Kubernetes. Kubernetes is a container-only orchestrator with a half-dozen interoperating services included. It is fair to say, that the architecture of Kubernetes is a complex one.

The HashiCorp logo and Nomad are trademarks of HashiCorp.

HashiCorp Nomad takes a different approach. It provides orchestration of containers and virtual machines. The goal is to provide a way clearer architecture, simpler usability and therefore improved maintainability. If you need additional functionality like service discovery or secret management, you simply combine Nomad with other HashiCorp products like Consul or Vault. On its own, Nomad tries to keep things as simple as possible.

Nomad vs Kubernetes. Image copyright by HashiCorp.

The whole functionality of Nomad is contained in a single binary. All you need to do, to install Nomad on a machine, is to download the Nomad binary. No complex setup scripts required!

Nomad then accepts commands to run “jobs”. A Nomad job is a specification provided by the user that declares a workload for Nomad. It states what container or VM should be run, how it should be exposed to the network, how much resources should be assigned etc. Nomad is then responsible to run this job for us.

Here is an example job specification for a dockerised web application:

job "demo" {
  datacenters = ["dc1"]
  type = "service"

  group "web" {
    count = 1

    network {
      port "http" {
        to = 80
      }
    }

    task "nginx" {
      driver = "docker"

      config {
        image = "nginxdemos/hello:latest"
        ports = ["http"]
      }

      resources {
        cpu    = 100
        memory = 128
      }
    }

  }
}

One of the biggest advantages of Nomad, compared to Kubernetes, is its hybrid cloud approach. As Nomad can orchestrate containers AND VMs, it can be integrated in your local datacenter and with multiple public cloud providers at the same time. Giving you not only the best of both worlds, but the best from ALL the worlds.

If you want to see a simple Nomad cluster in action, feel free to checkout the following video. I am going through installing Nomad, running a Nomad server and client, creating a simple web application job and running it on a Nomad cluster: