Learn NOMAD with Real Code Examples

Updated Nov 27, 2025

Explain

Nomad schedules and runs applications and services across clusters of servers.

Supports containers (Docker, OCI), virtual machines, Java, Go, and custom workloads.

Provides declarative job specifications in HCL or JSON.

Integrates with HashiCorp Consul for service discovery and Vault for secrets management.

Facilitates scalable, multi-region deployments with high availability and resilience.

Core Features

Job scheduling and orchestration

Task groups and task definitions

Auto-scaling based on resource usage

Periodic, batch, and service jobs

Integration with HashiCorp ecosystem (Vault, Consul, Terraform)

Basic Concepts Overview

Job - top-level workload definition

Task - individual container, process, or workload inside a job

Task Group - collection of tasks that share resources

Allocation - runtime instance of a task group on a client

Evaluations - server scheduling decisions triggered by job changes

Project Structure

jobs/ - directory containing HCL/JSON job files

scripts/ - automation scripts for job deployment

README.md - instructions and parameters

ci/ - CI/CD pipeline configuration

env/ - environment-specific variable files

Building Workflow

Write HCL/JSON job specification

Register job with Nomad via CLI or API

Monitor allocation and task status

Scale jobs by updating counts or constraints

Integrate with Consul and Vault for discovery and secrets

Difficulty Use Cases

Beginner: single-task Docker container

Intermediate: multi-task job with dependencies

Advanced: multi-region and multi-datacenter deployments

Expert: dynamic scaling and batch workloads

Enterprise: hybrid-cloud orchestration with Vault and Consul integration

Comparisons

Nomad vs Kubernetes: lightweight vs feature-rich orchestration

Nomad vs Docker Swarm: more flexible workload types

Nomad vs ECS: multi-cloud and hybrid support

Nomad vs HashiCorp Waypoint: low-level vs higher-level deployment workflow

Nomad vs OpenShift Templates: scheduling vs templating resources

Versioning Timeline

2015 - Initial release by HashiCorp

2016 - Added multi-region support

2017 - Introduced ACL and namespace support

2019 - Enterprise features added

2025 - Continued enterprise and community support

Glossary

Job - top-level workload

Task - unit of work inside a job

Task Group - collection of tasks with shared resources

Allocation - a scheduled instance of a task group

Evaluation - server scheduling decision