What is the difference between an allocation and deployment?

What is the difference between an allocation and deployment? I see these two concepts used across the documentation / HTTP API / CLI but there is no explanation of what a deployment is anywhere.

Hey @jlkiri,

There is a decent guide for Nomad Vocab here, which has allocation but I just realized it doesn’t explain what deployments are. We should fix that!

I like to think of allocations as the space/resources dedicated to a task on each machine. If you have one job that runs a docker container and has a count of 100, then there will be 100 allocations created across your cluster, across multiple machines to run those 100 containers. You can think of it as the sections of the client machines “allocated” to running each of those workloads.

A deployment is the actual object that represents a change or update to a job. So if I update my jobspec from “image = mnomitch/webapp:v1” to “image = mnomitch/webapp:v2” and hit submit, a “deployment” will be created that tracks this change. The update block determines what this looks like for each job. You might have a “rolling deployment” which could replace each allocation one by one with a new allocation using the new image, or you might have a “blue/green deployment” which spins up all the new allocations before removing the old ones. Deployments can fail and “roll back” to the old state, and you’ll be able to query the API to view the status of historical or current deployments.

Two things worth noting:

  • Kubernetes uses “deployment” differently, so this can be extra confusing if you’re coming from K8s.
  • Batch, System, and Sysbatch jobs don’t have official “deployments” only service jobs do (for now). They’ll of course update if your jobspec changes, but they won’t have the fancy rollout/rollback behavior.
1 Like

Thanks for the clarification!