liveBook · Manning

Nomad job

As explained in Road to Kubernetes

A Nomad job is a declarative specification of workloads and their required deployment configuration for HashiCorp Nomad.

A Nomad job is a declarative HCL definition for deploying a collection of container tasks to a Nomad cluster. Jobs contain groups, and groups contain tasks. section 9.2.1 section 9.2.5

A job definition connects deployment requirements to the containers Nomad should run:

  • Set a task's Docker driver and container image. section 9.2.5
  • Place related tasks in a group and optionally set a task count. section 9.2.5
  • Map network ports to container ports and associate tasks with services. section 9.2.5
  • Plan, run, stop, and purge jobs through the Nomad server UI. section 9.2.5
Listing 9.8 Nomad job definition
job "a_unique_job_name" {
  group "unique_group_per_job" {
    task "unique_task_per_group" {
      driver = "docker"
      config {
        image = "codingforentrepreneurs/rk8s-py"
      }
    }
  }
}

Start with one group and one Docker task, then extend the same HCL structure with additional tasks, ports, and services. section 9.2.5

How Road to Kubernetes covers it

How deep it goes
Explains job-group-task nesting, Docker images, ports, services, UI planning, running, and removal; defers private-image configuration and UI internals.
Examples
Uses Python and JavaScript container images, a two-task web job, mapped ports, services, and Nomad UI operations.
What it assumes
Assumes a Nomad server, client nodes, HCL, Docker runtime, and accessible container image; private-image setup is deferred.
What you can do after
Operate/configure jobs by writing HCL, planning and running them in the Nomad UI, then stopping and purging them.
How it connects
Connects tasks, groups, Docker runtime, container images, network ports, services, and Nomad clients and servers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.