# HashiCorp Nomad — Flexible Workload Orchestrator > Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy containers, VMs, Java apps, and binaries on bare metal. Smaller and simpler than Kubernetes with native Consul and Vault integration. ## Install Save as a script file and run: ## Quick Use ```bash # Install brew install hashicorp/tap/nomad # macOS # Or download binary from https://www.nomadproject.io/downloads # Dev mode (single-node) nomad agent -dev # Check nomad node status nomad server members ``` Simple job `web.nomad.hcl`: ```hcl job "web" { datacenters = ["dc1"] type = "service" group "webs" { count = 3 network { port "http" { to = 80 } } service { name = "web" port = "http" check { type = "http" path = "/" interval = "10s" timeout = "2s" } } task "nginx" { driver = "docker" config { image = "nginx:alpine" ports = ["http"] } resources { cpu = 200 memory = 128 } } } } ``` ```bash nomad job plan web.nomad.hcl nomad job run web.nomad.hcl nomad job status web ``` ## Intro HashiCorp Nomad is an easy-to-use, flexible, and performant workload orchestrator. Unlike Kubernetes (which targets containers), Nomad schedules any workload: Docker, Podman, raw binaries, Java JARs, Windows services, QEMU VMs. Smaller and simpler than K8s with native Consul service discovery and Vault secrets integration. - **Repo**: https://github.com/hashicorp/nomad - **Stars**: 16K+ - **Language**: Go - **License**: BUSL 1.1 (source-available) ## What Nomad Does - **Multi-workload** — Docker, raw exec, Java, Windows, QEMU - **Service discovery** — Consul integration or native - **Secrets** — Vault integration - **Bin packing** — optimal placement algorithm - **Blue-green / canary** — deploy strategies built in - **Rolling updates** — with health checks - **Batch jobs** — periodic, batch, system types - **Spread / affinity** — placement constraints - **ACLs** — fine-grained access control - **Federation** — multi-region clusters ## Architecture Servers form a Raft-consensus cluster for scheduling decisions. Clients run on each node to execute tasks. Schedulers (service, batch, system, sysbatch) place workloads based on constraints and resources. Nomad is a single Go binary per role. ## Self-Hosting ```hcl # server.hcl data_dir = "/opt/nomad/data" server { enabled = true bootstrap_expect = 3 } ``` ```hcl # client.hcl data_dir = "/opt/nomad/data" client { enabled = true servers = ["nomad-server-1:4647"] } ``` ## Key Features - Multi-workload orchestration - Single Go binary - Simpler than Kubernetes - Native Consul + Vault integration - Rolling deploys, canary, blue-green - Multi-region federation - ACL system - Spread and affinity placement - CSI volume support ## Comparison | Orchestrator | Workloads | Complexity | Ecosystem | |---|---|---|---| | Nomad | Docker, VM, bare | Low | Smaller | | Kubernetes | Containers | High | Huge | | Docker Swarm | Docker | Very low | Declining | | HashiCorp Waypoint | Containers | Low | Newer | | Mesos + Marathon | Anything | Very high | Declining | ## 常见问题 FAQ **Q: Nomad vs Kubernetes?** A: K8s 功能完备但复杂、学习曲线陡;Nomad 单 binary、简单、能跑非容器负载。中小团队 Nomad 够用且运维便宜;大团队生态选 K8s。 **Q: BUSL 是什么?** A: Business Source License 1.1 — 4 年转 MPL 2.0 开源、中间版本禁止与 Nomad 竞争的商用。自用、非竞品商用完全 OK。 **Q: 需要 Consul 吗?** A: 不强制。Nomad v1.3+ 有原生 service discovery。但要高级功能(service mesh、KV、分布式锁)还是建议 Consul。 ## 来源与致谢 Sources - Docs: https://www.nomadproject.io/docs - GitHub: https://github.com/hashicorp/nomad - License: BUSL 1.1 --- Source: https://tokrepo.com/en/workflows/a2aa9c27-35f3-11f1-9bc6-00163e2b0d79 Author: Script Depot